Spaces:
Build error
Build error
Download app.py from eternalBlissard/testVariable: direct link, hf CLI and curl.
- Browser
- Download file 542 Bytes
-
https://huggingface.co/spaces/eternalBlissard/testVariable/resolve/main/app.py
- Command line
-
hf download hf://spaces/eternalBlissard/testVariable/app.py
-
curl -L -o app.py https://huggingface.co/spaces/eternalBlissard/testVariable/resolve/main/app.py
542 Bytes
| import gradio as gr | |
| def respond(newVal, previous_val): | |
| if previous_val is None: | |
| previous_val = newVal | |
| return previous_val | |
| with gr.Blocks() as demo: | |
| val = gr.State(None) | |
| input_text = gr.Textbox(label="Input") | |
| output_text = gr.Textbox(label="Output") | |
| submit_button = gr.Button("Submit") | |
| def on_submit(newVal, previous_val): | |
| updated_val = respond(newVal, previous_val) | |
| return updated_val, updated_val | |
| submit_button.click(on_submit, [input_text, val], [val, output_text]) | |
| demo.launch() |