Classtest / app.py
simonraj's picture
Create app.py
c943374 verified
raw
history blame
645 Bytes
import gradio as gr
def update_dropdown(class_prefix):
# Create a list of options based on the selected class prefix
student_numbers = [f"{class_prefix}{str(i).zfill(2)}" for i in range(1, 41)]
return student_numbers
# Define the options for the first dropdown
class_options = ["5H", "5E", "5RS"]
# Create the Gradio interface
with gr.Blocks() as demo:
with gr.Row():
class_dropdown = gr.Dropdown(label="Class", choices=class_options)
student_dropdown = gr.Dropdown(label="Student")
class_dropdown.change(fn=update_dropdown, inputs=class_dropdown, outputs=student_dropdown)
# Launch the app
demo.launch()