Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def update_dropdown(class_prefix):
|
4 |
+
# Create a list of options based on the selected class prefix
|
5 |
+
student_numbers = [f"{class_prefix}{str(i).zfill(2)}" for i in range(1, 41)]
|
6 |
+
return student_numbers
|
7 |
+
|
8 |
+
# Define the options for the first dropdown
|
9 |
+
class_options = ["5H", "5E", "5RS"]
|
10 |
+
|
11 |
+
# Create the Gradio interface
|
12 |
+
with gr.Blocks() as demo:
|
13 |
+
with gr.Row():
|
14 |
+
class_dropdown = gr.Dropdown(label="Class", choices=class_options)
|
15 |
+
student_dropdown = gr.Dropdown(label="Student")
|
16 |
+
|
17 |
+
class_dropdown.change(fn=update_dropdown, inputs=class_dropdown, outputs=student_dropdown)
|
18 |
+
|
19 |
+
# Launch the app
|
20 |
+
demo.launch()
|