Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,22 +8,22 @@ import tempfile
|
|
8 |
import numpy as np
|
9 |
from PIL import Image
|
10 |
import shutil
|
|
|
|
|
|
|
11 |
# λ‘κΉ
μ€μ
|
12 |
logging.basicConfig(level=logging.INFO)
|
13 |
|
14 |
-
import httpx
|
15 |
-
|
16 |
# νμμμ μ€μ μ 30μ΄λ‘ λλ¦Ό
|
17 |
-
|
18 |
-
api_client = Client("http://211.233.58.202:7960/", client=client)
|
19 |
|
20 |
max_retries = 3
|
21 |
retry_delay = 5 # 5μ΄ λκΈ°
|
22 |
|
23 |
for attempt in range(max_retries):
|
24 |
try:
|
25 |
-
|
26 |
-
api_client =
|
27 |
break # μ±κ³΅νλ©΄ 루ν μ’
λ£
|
28 |
except httpx.ReadTimeout:
|
29 |
if attempt < max_retries - 1: # λ§μ§λ§ μλκ° μλλ©΄
|
@@ -32,6 +32,7 @@ for attempt in range(max_retries):
|
|
32 |
else:
|
33 |
print("Failed to connect after multiple attempts.")
|
34 |
raise # λͺ¨λ μλ μ€ν¨ μ μμΈ λ°μ
|
|
|
35 |
|
36 |
# κ°€λ¬λ¦¬ μ μ₯ λλ ν 리 μ€μ
|
37 |
GALLERY_DIR = "gallery"
|
|
|
8 |
import numpy as np
|
9 |
from PIL import Image
|
10 |
import shutil
|
11 |
+
import httpx
|
12 |
+
import time
|
13 |
+
|
14 |
# λ‘κΉ
μ€μ
|
15 |
logging.basicConfig(level=logging.INFO)
|
16 |
|
|
|
|
|
17 |
# νμμμ μ€μ μ 30μ΄λ‘ λλ¦Ό
|
18 |
+
httpx_client = httpx.Client(timeout=30.0)
|
|
|
19 |
|
20 |
max_retries = 3
|
21 |
retry_delay = 5 # 5μ΄ λκΈ°
|
22 |
|
23 |
for attempt in range(max_retries):
|
24 |
try:
|
25 |
+
api_client = Client("http://211.233.58.202:7960/")
|
26 |
+
api_client.httpx_client = httpx_client # httpx ν΄λΌμ΄μΈνΈ μ€μ
|
27 |
break # μ±κ³΅νλ©΄ 루ν μ’
λ£
|
28 |
except httpx.ReadTimeout:
|
29 |
if attempt < max_retries - 1: # λ§μ§λ§ μλκ° μλλ©΄
|
|
|
32 |
else:
|
33 |
print("Failed to connect after multiple attempts.")
|
34 |
raise # λͺ¨λ μλ μ€ν¨ μ μμΈ λ°μ
|
35 |
+
|
36 |
|
37 |
# κ°€λ¬λ¦¬ μ μ₯ λλ ν 리 μ€μ
|
38 |
GALLERY_DIR = "gallery"
|