Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import gradio as gr
|
|
| 3 |
def update_list(current_list, _):
|
| 4 |
if not current_list:
|
| 5 |
current_list = []
|
| 6 |
-
new_item = f"Item {len(current_list) + 1}" #
|
| 7 |
current_list.append(new_item)
|
| 8 |
return current_list
|
| 9 |
|
|
@@ -14,8 +14,7 @@ with gr.Blocks() as demo:
|
|
| 14 |
|
| 15 |
state = gr.State([]) # Initialize state
|
| 16 |
|
| 17 |
-
# When button is clicked, update list
|
| 18 |
-
button.click(fn=update_list, inputs=[state, button], outputs=state)
|
| 19 |
-
state.change(fn=lambda x: x, inputs=state, outputs=radio)
|
| 20 |
|
| 21 |
demo.launch()
|
|
|
|
| 3 |
def update_list(current_list, _):
|
| 4 |
if not current_list:
|
| 5 |
current_list = []
|
| 6 |
+
new_item = f"Item {len(current_list) + 1}" # Dynamically generating new items
|
| 7 |
current_list.append(new_item)
|
| 8 |
return current_list
|
| 9 |
|
|
|
|
| 14 |
|
| 15 |
state = gr.State([]) # Initialize state
|
| 16 |
|
| 17 |
+
# When button is clicked, update the list and radio
|
| 18 |
+
button.click(fn=update_list, inputs=[state, button], outputs=[state, radio])
|
|
|
|
| 19 |
|
| 20 |
demo.launch()
|