Update TextGen/router.py
Browse files68 unmodified lines69707172737475767778798081828384858687888990919293949596979868 unmodified lines@app.get("/generate_wav")async def generate_wav(request: Request):try:body = await request.json()text = body.get("text")language = body.get("language", "en")voice_choice = body.get("voice_choice", "./blacksmith.mp3")valid_voices = ["./voices/blacksmith.mp3","./voices/female.wav","./voices/female.mp3","./voices/narator_out.wav","./voices/blacksmith2.mp3"]if voice_choice not in valid_voices:raise HTTPException(status_code=400, detail="Invalid voice choice")# Use the Gradio client to generate the wav fileresult = tts_client.predict(text, # str in 'Text Prompt' Textbox componentlanguage, # str in 'Language' Dropdown componentvoice_choice, # str (filepath on your computer (or URL) of file) in 'Reference Audio' Audio componentvoice_choice, # str (filepath on your computer (or URL) of file) in 'Use Microphone for Reference' Audio componentFalse, # bool in 'Use Microphone' Checkbox componentFalse, # bool in 'Cleanup Reference Voice' Checkbox componentFalse, # bool in 'Do not use language auto-detect' Checkbox component68 unmodified lines697071727374757677787980818268 unmodified lines@app.get("/generate_wav")async def generate_wav(text: str, language: str = "en",voice:str="./voices/blacksmith.mp3):try:# Use the Gradio client to generate the wav fileresult = tts_client.predict(text, # str in 'Text Prompt' Textbox componentlanguage, # str in 'Language' Dropdown componentvoice, # str (filepath on your computer (or URL) of file) in 'Reference Audio' Audio componentvoice, # str (filepath on your computer (or URL) of file) in 'Use Microphone for Reference' Audio componentFalse, # bool in 'Use Microphone' Checkbox componentFalse, # bool in 'Cleanup Reference Voice' Checkbox componentFalse, # bool in 'Do not use language auto-detect' Checkbox component
TextGen/router.py+3-19