Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ from fastapi import FastAPI
|
|
| 2 |
import edge_tts
|
| 3 |
import asyncio
|
| 4 |
from fastapi.responses import FileResponse
|
|
|
|
| 5 |
|
| 6 |
app = FastAPI()
|
| 7 |
|
|
@@ -19,3 +20,6 @@ async def tts(text: str, voice: str = "en-US-AriaNeural"):
|
|
| 19 |
|
| 20 |
return FileResponse(output_file, media_type="audio/mpeg", filename="speech.mp3")
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import edge_tts
|
| 3 |
import asyncio
|
| 4 |
from fastapi.responses import FileResponse
|
| 5 |
+
import uvicorn
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
|
|
|
|
| 20 |
|
| 21 |
return FileResponse(output_file, media_type="audio/mpeg", filename="speech.mp3")
|
| 22 |
|
| 23 |
+
# Ensure the app starts when running in Hugging Face Spaces
|
| 24 |
+
if __name__ == "__main__":
|
| 25 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|