fantaxy commited on
Commit
a523f20
Β·
verified Β·
1 Parent(s): cf6167a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
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
- 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: # λ§ˆμ§€λ§‰ μ‹œλ„κ°€ μ•„λ‹ˆλ©΄
@@ -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"