Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -111,13 +111,14 @@ async def download_file_from_url(url: str) -> str | None:
|
|
| 111 |
"""
|
| 112 |
try:
|
| 113 |
async with httpx.AsyncClient() as client:
|
| 114 |
-
response = await client.get(url, timeout=
|
| 115 |
response.raise_for_status() # raises for non-200 status codes
|
| 116 |
|
| 117 |
# Save to a temporary file
|
| 118 |
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".wav")
|
| 119 |
temp_file.write(response.content)
|
| 120 |
temp_file.close()
|
|
|
|
| 121 |
return temp_file.name
|
| 122 |
|
| 123 |
except Exception as e:
|
|
|
|
| 111 |
"""
|
| 112 |
try:
|
| 113 |
async with httpx.AsyncClient() as client:
|
| 114 |
+
response = await client.get(url, timeout=60.0) # optional timeout
|
| 115 |
response.raise_for_status() # raises for non-200 status codes
|
| 116 |
|
| 117 |
# Save to a temporary file
|
| 118 |
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".wav")
|
| 119 |
temp_file.write(response.content)
|
| 120 |
temp_file.close()
|
| 121 |
+
print(f"downloaded {url} successfully")
|
| 122 |
return temp_file.name
|
| 123 |
|
| 124 |
except Exception as e:
|