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"
|