sachin
commited on
Commit
·
453f545
1
Parent(s):
ef20fe6
end-to-end
Browse files- src/server/main.py +2 -2
src/server/main.py
CHANGED
@@ -774,9 +774,9 @@ async def transcribe_audio(file: UploadFile = File(...), language: str = Query(.
|
|
774 |
except Exception as e:
|
775 |
logger.error(f"Error in transcription: {str(e)}")
|
776 |
raise HTTPException(status_code=500, detail=f"Transcription failed: {str(e)}")
|
777 |
-
|
778 |
@app.post("/v1/speech_to_speech")
|
779 |
async def speech_to_speech(
|
|
|
780 |
file: UploadFile = File(...),
|
781 |
language: str = Query(..., enum=list(asr_manager.model_language.keys())),
|
782 |
voice: str = Body(default=config.voice)
|
@@ -791,7 +791,7 @@ async def speech_to_speech(
|
|
791 |
src_lang=LANGUAGE_TO_SCRIPT.get(language, "kan_Knda"), # Dynamic script mapping
|
792 |
tgt_lang=LANGUAGE_TO_SCRIPT.get(language, "kan_Knda")
|
793 |
)
|
794 |
-
processed_text = await chat(
|
795 |
logger.info(f"Processed text: {processed_text.response}")
|
796 |
|
797 |
# Step 3: Convert processed text to speech
|
|
|
774 |
except Exception as e:
|
775 |
logger.error(f"Error in transcription: {str(e)}")
|
776 |
raise HTTPException(status_code=500, detail=f"Transcription failed: {str(e)}")
|
|
|
777 |
@app.post("/v1/speech_to_speech")
|
778 |
async def speech_to_speech(
|
779 |
+
request: Request, # Inject Request object from FastAPI
|
780 |
file: UploadFile = File(...),
|
781 |
language: str = Query(..., enum=list(asr_manager.model_language.keys())),
|
782 |
voice: str = Body(default=config.voice)
|
|
|
791 |
src_lang=LANGUAGE_TO_SCRIPT.get(language, "kan_Knda"), # Dynamic script mapping
|
792 |
tgt_lang=LANGUAGE_TO_SCRIPT.get(language, "kan_Knda")
|
793 |
)
|
794 |
+
processed_text = await chat(request, chat_request) # Pass the injected request
|
795 |
logger.info(f"Processed text: {processed_text.response}")
|
796 |
|
797 |
# Step 3: Convert processed text to speech
|