Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,19 +56,11 @@ async def chat(message: str, session_id: str = "default"):
|
|
| 56 |
|
| 57 |
|
| 58 |
@app.post("/stt")
|
| 59 |
-
async def
|
| 60 |
return await STT(file)
|
| 61 |
|
| 62 |
|
| 63 |
@app.post("/tts")
|
| 64 |
-
async def
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
if not os.path.exists(audio_path):
|
| 68 |
-
raise HTTPException(status_code=500, detail="Audio not generated")
|
| 69 |
-
|
| 70 |
-
return FileResponse(
|
| 71 |
-
path=audio_path,
|
| 72 |
-
media_type="audio/mpeg",
|
| 73 |
-
filename="speech.mp3"
|
| 74 |
-
)
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
@app.post("/stt")
|
| 59 |
+
async def stt(file: UploadFile = File(...)):
|
| 60 |
return await STT(file)
|
| 61 |
|
| 62 |
|
| 63 |
@app.post("/tts")
|
| 64 |
+
async def tts(text: str):
|
| 65 |
+
path = await TTS(text)
|
| 66 |
+
return FileResponse(path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|