Spaces:
Sleeping
Sleeping
Commit
·
f0feabf
1
Parent(s):
c550535
Update main.py
Browse files
main.py
CHANGED
|
@@ -8,6 +8,7 @@ import base64
|
|
| 8 |
import requests
|
| 9 |
import os
|
| 10 |
import socket
|
|
|
|
| 11 |
|
| 12 |
#--------------------------------------------------- Definizione Server FAST API ------------------------------------------------------
|
| 13 |
app = FastAPI()
|
|
@@ -98,6 +99,7 @@ def generate_image(request: Request, input_data: InputImage):
|
|
| 98 |
return {"response": img_base64}
|
| 99 |
except requests.exceptions.HTTPError as e:
|
| 100 |
if e.response.status_code == 500:
|
|
|
|
| 101 |
attempt += 1
|
| 102 |
if attempt < max_attempts:
|
| 103 |
continue
|
|
|
|
| 8 |
import requests
|
| 9 |
import os
|
| 10 |
import socket
|
| 11 |
+
import time
|
| 12 |
|
| 13 |
#--------------------------------------------------- Definizione Server FAST API ------------------------------------------------------
|
| 14 |
app = FastAPI()
|
|
|
|
| 99 |
return {"response": img_base64}
|
| 100 |
except requests.exceptions.HTTPError as e:
|
| 101 |
if e.response.status_code == 500:
|
| 102 |
+
time.sleep(1)
|
| 103 |
attempt += 1
|
| 104 |
if attempt < max_attempts:
|
| 105 |
continue
|