anuj-exe commited on
Commit
9e16c9e
·
verified ·
1 Parent(s): 314cdcc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -23
app.py CHANGED
@@ -1,4 +1,3 @@
1
- import gradio as gr
2
  from TTS.api import TTS
3
  from fastapi import FastAPI, Request
4
  from fastapi.responses import FileResponse, JSONResponse
@@ -70,28 +69,7 @@ async def predict(request: Request):
70
  return FileResponse(audio_path, media_type="audio/wav", filename="output.wav", headers=headers)
71
 
72
  # -----------------------------
73
- # Gradio UI
74
- # -----------------------------
75
- demo = gr.Interface(
76
- fn=synthesize,
77
- inputs=[
78
- gr.Textbox(label="Text"),
79
- gr.Dropdown(choices=["male", "female"], value="female", label="Speaker")
80
- ],
81
- outputs=[gr.Audio(type="filepath"), gr.JSON()],
82
- title="YourTTS Voice Cloning (English Only, Select Speaker)",
83
- allow_flagging="never"
84
- )
85
-
86
- # -----------------------------
87
- # Run both FastAPI + Gradio
88
  # -----------------------------
89
  if __name__ == "__main__":
90
- import threading
91
-
92
- def launch_gradio():
93
- demo.launch(server_name="0.0.0.0", server_port=7861, show_api=False)
94
-
95
- threading.Thread(target=launch_gradio, daemon=True).start()
96
-
97
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
 
1
  from TTS.api import TTS
2
  from fastapi import FastAPI, Request
3
  from fastapi.responses import FileResponse, JSONResponse
 
69
  return FileResponse(audio_path, media_type="audio/wav", filename="output.wav", headers=headers)
70
 
71
  # -----------------------------
72
+ # Run FastAPI
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  # -----------------------------
74
  if __name__ == "__main__":
 
 
 
 
 
 
 
75
  uvicorn.run(app, host="0.0.0.0", port=7860)