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"