Spaces:
Paused
Paused
Update app.py
Browse files
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 |
-
|
| 200 |
-
|
| 201 |
-
|
| 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 |
|