Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
sachin
commited on
Commit
·
1b03edb
1
Parent(s):
1d88a56
add-additional time outs
Browse files- src/server/main.py +5 -5
src/server/main.py
CHANGED
@@ -108,7 +108,7 @@ class ExternalTTSService(TTSService):
|
|
108 |
json=payload,
|
109 |
headers={"accept": "application/json", "Content-Type": "application/json"},
|
110 |
stream=True,
|
111 |
-
timeout=
|
112 |
)
|
113 |
except requests.Timeout:
|
114 |
raise HTTPException(status_code=504, detail="External TTS API timeout")
|
@@ -206,7 +206,7 @@ async def chat(request: Request, chat_request: ChatRequest):
|
|
206 |
"accept": "application/json",
|
207 |
"Content-Type": "application/json"
|
208 |
},
|
209 |
-
timeout=
|
210 |
)
|
211 |
response.raise_for_status() # Raise an exception for bad status codes
|
212 |
|
@@ -251,7 +251,7 @@ async def process_audio(
|
|
251 |
external_url,
|
252 |
files=files,
|
253 |
headers={"accept": "application/json"},
|
254 |
-
timeout=
|
255 |
)
|
256 |
response.raise_for_status()
|
257 |
|
@@ -289,7 +289,7 @@ async def transcribe_audio(
|
|
289 |
external_url,
|
290 |
files=files,
|
291 |
headers={"accept": "application/json"},
|
292 |
-
timeout=
|
293 |
)
|
294 |
response.raise_for_status()
|
295 |
|
@@ -361,7 +361,7 @@ async def translate(request: TranslationRequest):
|
|
361 |
"accept": "application/json",
|
362 |
"Content-Type": "application/json"
|
363 |
},
|
364 |
-
timeout=
|
365 |
)
|
366 |
|
367 |
# Raise an exception for bad status codes (4xx, 5xx)
|
|
|
108 |
json=payload,
|
109 |
headers={"accept": "application/json", "Content-Type": "application/json"},
|
110 |
stream=True,
|
111 |
+
timeout=60
|
112 |
)
|
113 |
except requests.Timeout:
|
114 |
raise HTTPException(status_code=504, detail="External TTS API timeout")
|
|
|
206 |
"accept": "application/json",
|
207 |
"Content-Type": "application/json"
|
208 |
},
|
209 |
+
timeout=60
|
210 |
)
|
211 |
response.raise_for_status() # Raise an exception for bad status codes
|
212 |
|
|
|
251 |
external_url,
|
252 |
files=files,
|
253 |
headers={"accept": "application/json"},
|
254 |
+
timeout=60
|
255 |
)
|
256 |
response.raise_for_status()
|
257 |
|
|
|
289 |
external_url,
|
290 |
files=files,
|
291 |
headers={"accept": "application/json"},
|
292 |
+
timeout=60
|
293 |
)
|
294 |
response.raise_for_status()
|
295 |
|
|
|
361 |
"accept": "application/json",
|
362 |
"Content-Type": "application/json"
|
363 |
},
|
364 |
+
timeout=60 # Set a timeout to avoid hanging
|
365 |
)
|
366 |
|
367 |
# Raise an exception for bad status codes (4xx, 5xx)
|