File size: 548 Bytes
c943374
 
e8fae22
c943374
e8fae22
c943374
e8fae22
 
 
c943374
e8fae22
c943374
 
9f654db
c943374
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr

# ... (rest of your code)

# Create the Gradio interface
with gr.Blocks() as demo:
    class_dropdown = gr.Dropdown(label="Class", choices=class_options)
    # Initialize the second dropdown with a callable for dynamic updates
    student_dropdown = gr.Dropdown(label="Student", choices=lambda: update_dropdown(class_options[0]))

    # Bind the update function to the change event of the class dropdown
    class_dropdown.change(fn=update_dropdown, inputs=class_dropdown, outputs=student_dropdown)

# Run the app
demo.launch()