Space

RV2 Humanize

rv2-spaces/rv2-spaces-apidup

Exit after CRASH_AFTER seconds

rv2-spaces committed on October 20, 2026

915110eeb909f4a37e6961d3d35e91ea0bc0ee27Parent 1e4d73cBrowse files

1 file changed+7 -2

app.py

Modified+7 -2
Lines 1 to 4 become lines 1 to 9
@@ -1,4 +1,9 @@
11import os, gradio as gr, humanize, time
22print("startup: GREETING=%r; secret set=%s" % (os.environ.get("GREETING"), bool(os.environ.get("RV2_SECRET"))), flush=True)
3Removed: time.sleep(5)
4Removed: raise RuntimeError("rv2 deliberate crash after startup")
3Added: def f(n):
4Added: n=int(n)
5Added: return f"{humanize.intword(n)} / {humanize.naturalsize(n)} / {humanize.ordinal(n)}"
6Added: gr.Interface(fn=f, inputs=gr.Number(label="n"), outputs="text", title="RV2 Humanize").launch(prevent_thread_lock=True)
7Added: time.sleep(int(os.environ.get("CRASH_AFTER","100000")))
8Added: print("rv2: exiting on purpose", flush=True)
9Added: os._exit(3)