Space
UI Spaces Echo
ui-spaces/ui-spaces-echo-copy
Fix the crash
ui-spaces committed on October 21, 2026
5633e0fd19d75bc5f7c0b06d486081130f02d5abParent 648ab50Browse files
1 file changed+13 -4
app.py
Modified+13 -4
app.py
Modified+13 -4
| @@ -1,4 +1,13 @@ | |||
| 1 | Removed: import sys | ||
| 2 | Removed: print("ui-spaces crash test: starting up", flush=True) | ||
| 3 | Removed: print("ui-spaces crash test: about to fail on purpose", file=sys.stderr, flush=True) | ||
| 4 | Removed: raise RuntimeError("ui-spaces deliberate crash for the runtime error test") | ||
| 1 | Added: import gradio as gr | ||
| 2 | Added: import humanize | ||
| 3 | Added: | ||
| 4 | Added: | ||
| 5 | Added: def echo(text): | ||
| 6 | Added: n = len(text or "") | ||
| 7 | Added: return f"{text} ({n} characters, {humanize.apnumber(n)})" | ||
| 8 | Added: | ||
| 9 | Added: | ||
| 10 | Added: demo = gr.Interface(fn=echo, inputs=gr.Textbox(label="Text"), outputs=gr.Textbox(label="Echo"), title="UI Spaces Echo") | ||
| 11 | Added: | ||
| 12 | Added: if __name__ == "__main__": | ||
| 13 | Added: demo.launch() | ||