Update main.py
Browse files
main.py
CHANGED
|
@@ -2,7 +2,6 @@ import os
|
|
| 2 |
import sys
|
| 3 |
import time
|
| 4 |
import signal
|
| 5 |
-
import psutil
|
| 6 |
import io
|
| 7 |
|
| 8 |
from fastapi import FastAPI, Request, status, Form, UploadFile
|
|
@@ -35,9 +34,12 @@ async def api_raw1(file: UploadFile = Form(...)):
|
|
| 35 |
try:
|
| 36 |
file_content = await file.read()
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
| 41 |
except Exception as e:
|
| 42 |
return {"error": str(e)}
|
| 43 |
|
|
@@ -46,8 +48,11 @@ async def api_raw2(file: UploadFile = Form(...)):
|
|
| 46 |
try:
|
| 47 |
file_content = await file.read()
|
| 48 |
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
return Response(content=
|
| 52 |
except Exception as e:
|
| 53 |
return {"error": str(e)}
|
|
|
|
| 2 |
import sys
|
| 3 |
import time
|
| 4 |
import signal
|
|
|
|
| 5 |
import io
|
| 6 |
|
| 7 |
from fastapi import FastAPI, Request, status, Form, UploadFile
|
|
|
|
| 34 |
try:
|
| 35 |
file_content = await file.read()
|
| 36 |
|
| 37 |
+
raw1, raw2 = fn.raw(file_content)
|
| 38 |
|
| 39 |
+
with open(raw1, 'rb') as f:
|
| 40 |
+
content = f.read()
|
| 41 |
+
|
| 42 |
+
return Response(content=content, media_type="audio/wav")
|
| 43 |
except Exception as e:
|
| 44 |
return {"error": str(e)}
|
| 45 |
|
|
|
|
| 48 |
try:
|
| 49 |
file_content = await file.read()
|
| 50 |
|
| 51 |
+
raw1, raw2 = fn.raw(file_content)
|
| 52 |
+
|
| 53 |
+
with open(raw2, 'rb') as f:
|
| 54 |
+
content = f.read()
|
| 55 |
|
| 56 |
+
return Response(content=content, media_type="audio/wav")
|
| 57 |
except Exception as e:
|
| 58 |
return {"error": str(e)}
|