Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,10 +11,28 @@ import shutil
|
|
| 11 |
# ๋ก๊น
์ค์
|
| 12 |
logging.basicConfig(level=logging.INFO)
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# ๊ฐค๋ฌ๋ฆฌ ์ ์ฅ ๋๋ ํ ๋ฆฌ ์ค์
|
| 19 |
GALLERY_DIR = "gallery"
|
| 20 |
GALLERY_JSON = "gallery.json"
|
|
|
|
| 11 |
# ๋ก๊น
์ค์
|
| 12 |
logging.basicConfig(level=logging.INFO)
|
| 13 |
|
| 14 |
+
import httpx
|
| 15 |
|
| 16 |
+
# ํ์์์ ์ค์ ์ 30์ด๋ก ๋๋ฆผ
|
| 17 |
+
client = httpx.Client(timeout=30.0)
|
| 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 |
+
client = httpx.Client(timeout=30.0)
|
| 26 |
+
api_client = Client("http://211.233.58.202:7960/", client=client)
|
| 27 |
+
break # ์ฑ๊ณตํ๋ฉด ๋ฃจํ ์ข
๋ฃ
|
| 28 |
+
except httpx.ReadTimeout:
|
| 29 |
+
if attempt < max_retries - 1: # ๋ง์ง๋ง ์๋๊ฐ ์๋๋ฉด
|
| 30 |
+
print(f"Connection timed out. Retrying in {retry_delay} seconds...")
|
| 31 |
+
time.sleep(retry_delay)
|
| 32 |
+
else:
|
| 33 |
+
print("Failed to connect after multiple attempts.")
|
| 34 |
+
raise # ๋ชจ๋ ์๋ ์คํจ ์ ์์ธ ๋ฐ์
|
| 35 |
+
|
| 36 |
# ๊ฐค๋ฌ๋ฆฌ ์ ์ฅ ๋๋ ํ ๋ฆฌ ์ค์
|
| 37 |
GALLERY_DIR = "gallery"
|
| 38 |
GALLERY_JSON = "gallery.json"
|