Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,10 @@ def predict(text, seed, out_seq_length, min_gen_length, sampling_strategy,
|
|
| 39 |
'Content-Type': 'application/json'
|
| 40 |
}
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
if response['status'] == 1:
|
| 45 |
return 'Please give smaller text than max_tokens or give larger max_tokens.'
|
|
|
|
| 39 |
'Content-Type': 'application/json'
|
| 40 |
}
|
| 41 |
|
| 42 |
+
try:
|
| 43 |
+
response = requests.request("POST", url, headers=headers, data=payload, timeout=(20, 100)).json()
|
| 44 |
+
except Exception as e:
|
| 45 |
+
print('Timeout! Please wait a few minutes and retry')
|
| 46 |
|
| 47 |
if response['status'] == 1:
|
| 48 |
return 'Please give smaller text than max_tokens or give larger max_tokens.'
|