Spaces:
Runtime error
Runtime error
adjusts sleep time
Browse files
app.py
CHANGED
@@ -70,17 +70,19 @@ 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 |
response = requests.post("http://0.0.0.0:5000/predictions", headers=headers, json=payload)
|
74 |
-
|
75 |
|
76 |
if response.status_code == 201:
|
|
|
77 |
follow_up_url = response.json()["urls"]["get"]
|
78 |
response = requests.get(follow_up_url, headers=headers)
|
79 |
while response.json()["status"] != "succeeded":
|
80 |
if response.json()["status"] == "failed":
|
81 |
raise gr.Error("The submission failed!")
|
82 |
response = requests.get(follow_up_url, headers=headers)
|
83 |
-
|
84 |
if response.status_code == 200:
|
85 |
|
86 |
json_response = response.json()
|
|
|
70 |
if value is not None and value != "":
|
71 |
payload["input"][key] = value
|
72 |
|
73 |
+
time.sleep(0.4)
|
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.4)
|
79 |
follow_up_url = response.json()["urls"]["get"]
|
80 |
response = requests.get(follow_up_url, headers=headers)
|
81 |
while response.json()["status"] != "succeeded":
|
82 |
if response.json()["status"] == "failed":
|
83 |
raise gr.Error("The submission failed!")
|
84 |
response = requests.get(follow_up_url, headers=headers)
|
85 |
+
|
86 |
if response.status_code == 200:
|
87 |
|
88 |
json_response = response.json()
|