Spaces:
Running
on
L40S
Running
on
L40S
increase tiny sleep time to handle server crashes on heavy load
Browse files
app.py
CHANGED
|
@@ -70,12 +70,12 @@ def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
|
|
| 70 |
if value is not None and value != "":
|
| 71 |
payload["input"][key] = value
|
| 72 |
|
| 73 |
-
time.sleep(0
|
| 74 |
response = requests.post("http://0.0.0.0:5000/predictions", headers=headers, json=payload)
|
| 75 |
|
| 76 |
|
| 77 |
if response.status_code == 201:
|
| 78 |
-
time.sleep(0
|
| 79 |
follow_up_url = response.json()["urls"]["get"]
|
| 80 |
response = requests.get(follow_up_url, headers=headers)
|
| 81 |
while response.json()["status"] != "succeeded":
|
|
|
|
| 70 |
if value is not None and value != "":
|
| 71 |
payload["input"][key] = value
|
| 72 |
|
| 73 |
+
time.sleep(1.0)
|
| 74 |
response = requests.post("http://0.0.0.0:5000/predictions", headers=headers, json=payload)
|
| 75 |
|
| 76 |
|
| 77 |
if response.status_code == 201:
|
| 78 |
+
time.sleep(1.0)
|
| 79 |
follow_up_url = response.json()["urls"]["get"]
|
| 80 |
response = requests.get(follow_up_url, headers=headers)
|
| 81 |
while response.json()["status"] != "succeeded":
|