gaandrade99's picture
Upload folder using huggingface_hub
2fb2a65 verified
Raw
History Blame Contribute Delete
882 Bytes
import requests, time, re
print("=== Monitoring Space ===")
for i in range(40):
r = requests.get("https://huggingface.co/api/spaces/gaandrade99/audioldm2-sfx-generator")
data = r.json()
stage = data.get("runtime", {}).get("stage", "unknown")
print("[%ds] %s" % (i * 15, stage))
if stage == "RUNNING":
print("\nSUCCESS! Space is RUNNING!")
break
if stage in ("RUNTIME_ERROR", "BUILD_ERROR"):
print("\nERROR: " + stage)
r3 = requests.get("https://huggingface.co/spaces/gaandrade99/audioldm2-sfx-generator")
t = r3.text
if "Reason:" in t:
idx = t.index("Reason:")
snippet = t[idx : idx + 800]
snippet = re.sub(r"<[^>]+>", " ", snippet)
print(snippet[:600])
break
time.sleep(15)
else:
print("Timeout after 10 minutes")