Spaces:
Running
on
T4
Running
on
T4
gorkemgoknar
commited on
Commit
•
5a8706b
1
Parent(s):
cbfd352
space building stage protection on restart
Browse files
app.py
CHANGED
@@ -212,9 +212,13 @@ def predict(
|
|
212 |
f"Unrecoverable exception caused by language:{DEVICE_ASSERT_LANG} prompt:{DEVICE_ASSERT_PROMPT}"
|
213 |
)
|
214 |
|
215 |
-
#
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
|
|
218 |
try:
|
219 |
metrics_text = ""
|
220 |
t_latent = time.time()
|
@@ -358,7 +362,12 @@ def predict(
|
|
358 |
)
|
359 |
|
360 |
# HF Space specific.. This error is unrecoverable need to restart space
|
361 |
-
api.
|
|
|
|
|
|
|
|
|
|
|
362 |
else:
|
363 |
if "Failed to decode" in str(e):
|
364 |
print("Speaker encoding error", str(e))
|
|
|
212 |
f"Unrecoverable exception caused by language:{DEVICE_ASSERT_LANG} prompt:{DEVICE_ASSERT_PROMPT}"
|
213 |
)
|
214 |
|
215 |
+
# HF Space specific.. This error is unrecoverable need to restart space
|
216 |
+
space = api.get_space_runtime(repo_id=repo_id)
|
217 |
+
if space.stage!="BUILDING":
|
218 |
+
api.restart_space(repo_id=repo_id)
|
219 |
+
else:
|
220 |
+
print("TRIED TO RESTART but space is building")
|
221 |
+
|
222 |
try:
|
223 |
metrics_text = ""
|
224 |
t_latent = time.time()
|
|
|
362 |
)
|
363 |
|
364 |
# HF Space specific.. This error is unrecoverable need to restart space
|
365 |
+
space = api.get_space_runtime(repo_id=repo_id)
|
366 |
+
if space.stage!="BUILDING":
|
367 |
+
api.restart_space(repo_id=repo_id)
|
368 |
+
else:
|
369 |
+
print("TRIED TO RESTART but space is building")
|
370 |
+
|
371 |
else:
|
372 |
if "Failed to decode" in str(e):
|
373 |
print("Speaker encoding error", str(e))
|