|
import gradio as gr |
|
|
|
|
|
def update_student_dropdown(class_selection): |
|
|
|
student_numbers = [f"{class_selection}{str(i).zfill(2)}" for i in range(1, 41)] |
|
return student_numbers |
|
|
|
|
|
class_options = ["5H", "5E", "5RS"] |
|
|
|
with gr.Blocks() as demo: |
|
class_dropdown = gr.Dropdown(label="Class", choices=class_options, value="5H") |
|
student_dropdown = gr.Dropdown(label="Student", choices=update_student_dropdown("5H")) |
|
|
|
|
|
class_dropdown.change(fn=update_student_dropdown, inputs=class_dropdown, outputs=student_dropdown) |
|
|
|
demo.launch() |