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