Spaces:
Runtime error
Runtime error
sergeipetrov
commited on
Commit
•
08450fa
1
Parent(s):
a9ac32a
Update embed_utils.py
Browse files- embed_utils.py +9 -9
embed_utils.py
CHANGED
@@ -51,15 +51,15 @@ def wake_up_endpoint():
|
|
51 |
if endpoint.status != 'running':
|
52 |
logger.info("Starting up TEI endpoint")
|
53 |
endpoint.resume().wait().fetch()
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
logger.info("TEI endpoint is up")
|
64 |
|
65 |
return
|
|
|
51 |
if endpoint.status != 'running':
|
52 |
logger.info("Starting up TEI endpoint")
|
53 |
endpoint.resume().wait().fetch()
|
54 |
+
n_loop = 0
|
55 |
+
while requests.get(
|
56 |
+
url=endpoint.url,
|
57 |
+
headers={"Authorization": f"Bearer {env_config.hf_token}"}
|
58 |
+
).status_code != 200:
|
59 |
+
time.sleep(2)
|
60 |
+
n_loop += 1
|
61 |
+
if n_loop > 20:
|
62 |
+
raise TimeoutError("TEI endpoint is unavailable")
|
63 |
logger.info("TEI endpoint is up")
|
64 |
|
65 |
return
|