seawolf2357 commited on
Commit
41a7b58
·
verified ·
1 Parent(s): 725cdfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -12,7 +12,6 @@ from requests.exceptions import HTTPError
12
  import matplotlib.pyplot as plt
13
  from io import BytesIO
14
  import base64
15
- import time
16
 
17
  # 로깅 설정
18
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s:%(message)s', handlers=[logging.StreamHandler()])
@@ -196,12 +195,9 @@ class MyClient(discord.Client):
196
  return await func()
197
  except HTTPError as e:
198
  if e.response.status_code == 503:
199
- if i < retries - 1:
200
- logging.warning(f"503 error encountered. Retrying in {delay} seconds...")
201
- await asyncio.sleep(delay)
202
- else:
203
- logging.warning("Switching to secondary model due to persistent 503 errors.")
204
- self.hf_client = hf_client_secondary
205
  else:
206
  raise
207
 
 
12
  import matplotlib.pyplot as plt
13
  from io import BytesIO
14
  import base64
 
15
 
16
  # 로깅 설정
17
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s:%(message)s', handlers=[logging.StreamHandler()])
 
195
  return await func()
196
  except HTTPError as e:
197
  if e.response.status_code == 503:
198
+ logging.warning(f"503 error encountered. Switching to secondary model.")
199
+ self.hf_client = hf_client_secondary
200
+ return await func() # Try immediately with the secondary model
 
 
 
201
  else:
202
  raise
203