Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -118,26 +118,6 @@ async def download_file_from_url(url: str) -> str:
|
|
| 118 |
|
| 119 |
#-----------------------------------------------------------
|
| 120 |
|
| 121 |
-
#___________________Test end point to test supabase fetch
|
| 122 |
-
|
| 123 |
-
from fastapi import Query
|
| 124 |
-
from fastapi.responses import Response
|
| 125 |
-
|
| 126 |
-
@app.get("/test-download/")
|
| 127 |
-
async def test_download(url: str = Query(...)):
|
| 128 |
-
try:
|
| 129 |
-
file_bytes = await download_file_from_url(url)
|
| 130 |
-
|
| 131 |
-
return Response(
|
| 132 |
-
content=file_bytes,
|
| 133 |
-
media_type="audio/wav" # change if needed
|
| 134 |
-
)
|
| 135 |
-
|
| 136 |
-
except Exception as e:
|
| 137 |
-
return {"error": str(e)}
|
| 138 |
-
#_________________________________________
|
| 139 |
-
|
| 140 |
-
|
| 141 |
#takes the text to be said and path to the prosody audio and path to save the generated audio and returns path to the generated audio
|
| 142 |
# (save_path -> full path including the filename, not just a folder.)
|
| 143 |
def inference_by_model(text: str, audio_file: str, save_path: str) -> str:
|
|
@@ -199,6 +179,25 @@ async def generate_story_audios(story: StoryCreationDTO, base_output: str = "sto
|
|
| 199 |
|
| 200 |
app = FastAPI(title="EGTTS Arabic TTS API")
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
@app.get("/")
|
| 203 |
def root():
|
| 204 |
return {"message": "Welcome! Visit /docs for Swagger UI."}
|
|
|
|
| 118 |
|
| 119 |
#-----------------------------------------------------------
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
#takes the text to be said and path to the prosody audio and path to save the generated audio and returns path to the generated audio
|
| 122 |
# (save_path -> full path including the filename, not just a folder.)
|
| 123 |
def inference_by_model(text: str, audio_file: str, save_path: str) -> str:
|
|
|
|
| 179 |
|
| 180 |
app = FastAPI(title="EGTTS Arabic TTS API")
|
| 181 |
|
| 182 |
+
#___________________Test end point to test supabase fetch
|
| 183 |
+
|
| 184 |
+
from fastapi import Query
|
| 185 |
+
from fastapi.responses import Response
|
| 186 |
+
|
| 187 |
+
@app.get("/test-download/")
|
| 188 |
+
async def test_download(url: str = Query(...)):
|
| 189 |
+
try:
|
| 190 |
+
file_bytes = await download_file_from_url(url)
|
| 191 |
+
|
| 192 |
+
return Response(
|
| 193 |
+
content=file_bytes,
|
| 194 |
+
media_type="audio/wav" # change if needed
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
except Exception as e:
|
| 198 |
+
return {"error": str(e)}
|
| 199 |
+
#_________________________________________
|
| 200 |
+
|
| 201 |
@app.get("/")
|
| 202 |
def root():
|
| 203 |
return {"message": "Welcome! Visit /docs for Swagger UI."}
|