junaid17 commited on
Commit
1ee432f
·
verified ·
1 Parent(s): fdd58a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -12
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 transcribe_audio(file: UploadFile = File(...)):
60
  return await STT(file)
61
 
62
 
63
  @app.post("/tts")
64
- async def generate_tts(request: TTSRequest):
65
- audio_path = await TTS(text=request.text)
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)