harishB97 commited on
Commit
359b475
·
verified ·
1 Parent(s): f1853ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -18
app.py CHANGED
@@ -174,26 +174,18 @@
174
 
175
  import gradio as gr
176
 
177
- def update_dropdown_2(selected_option, dropdown_2_choices):
178
- if selected_option == "Option 1":
179
- new_options = ["Suboption 1.1", "Suboption 1.2"]
180
- elif selected_option == "Option 2":
181
- new_options = ["Suboption 2.1", "Suboption 2.2"]
182
- else:
183
- new_options = ["Suboption 3.1", "Suboption 3.2"]
184
-
185
- return new_options
186
 
187
  with gr.Blocks() as demo:
188
- with gr.Row():
189
- dropdown_1 = gr.Dropdown(["Option 1", "Option 2", "Option 3"], label="Main Options")
190
- dropdown_2 = gr.Dropdown(["Suboption 1.1", "Suboption 1.2"], label="Sub Options")
191
-
192
- def on_dropdown_1_change(selected_option):
193
- new_choices = update_dropdown_2(selected_option, dropdown_2)
194
- dropdown_2.update(choices=new_choices)
195
-
196
- dropdown_1.change(on_dropdown_1_change, inputs=dropdown_1, outputs=dropdown_2)
197
 
198
  demo.launch()
199
 
 
174
 
175
  import gradio as gr
176
 
177
+ def welcome(name):
178
+ return f"Welcome to Gradio, {name}!"
 
 
 
 
 
 
 
179
 
180
  with gr.Blocks() as demo:
181
+ gr.Markdown(
182
+ """
183
+ # Hello World!
184
+ Start typing below to see the output.
185
+ """)
186
+ inp = gr.Textbox(placeholder="What is your name?")
187
+ out = gr.Textbox()
188
+ inp.change(welcome, inp, out)
 
189
 
190
  demo.launch()
191