Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -78,31 +78,24 @@ def get_dropdown_options(file_path, column_name):
|
|
78 |
options = df["Name"].dropna().unique().tolist()
|
79 |
return options
|
80 |
|
81 |
-
# Define the Gradio interface
|
82 |
-
def dropdown_demo():
|
83 |
-
# File path and column to read
|
84 |
-
file_path = "participants_form.xlsx" # Replace with your Excel file path
|
85 |
-
column_name = "Name" # Replace with your column name in the Excel file
|
86 |
-
|
87 |
-
# Populate dropdown options
|
88 |
-
options = get_dropdown_options(file_path, column_name)
|
89 |
-
|
90 |
-
# Define a Gradio app
|
91 |
-
with gr.Blocks() as demo:
|
92 |
-
dropdown = gr.Dropdown(choices=options, label="Select an Option")
|
93 |
-
output = gr.Textbox(label="You Selected")
|
94 |
-
|
95 |
-
def show_selection(choice):
|
96 |
-
return f"You selected: {choice}"
|
97 |
|
98 |
-
dropdown.change(show_selection, inputs=[dropdown], outputs=[output])
|
99 |
|
100 |
with gr.Blocks() as app:
|
101 |
gr.Markdown("# Attendance Tracker")
|
102 |
|
103 |
with gr.Row():
|
104 |
# name = gr.Textbox(label="Name")
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
day = gr.Textbox(label="Day")
|
107 |
date = gr.Textbox(label="Date (YYYY-MM-DD)")
|
108 |
status = gr.Radio(["Present", "Absent"], label="Status")
|
|
|
78 |
options = df["Name"].dropna().unique().tolist()
|
79 |
return options
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
|
|
82 |
|
83 |
with gr.Blocks() as app:
|
84 |
gr.Markdown("# Attendance Tracker")
|
85 |
|
86 |
with gr.Row():
|
87 |
# name = gr.Textbox(label="Name")
|
88 |
+
file_path = "participants_form.xlsx"
|
89 |
+
column_name = "Name"
|
90 |
+
options = get_dropdown_options(file_path, column_name)
|
91 |
+
name = gr.Dropdown(choices=options, label="Select an Option")
|
92 |
+
output = gr.Textbox(label="You Selected")
|
93 |
+
|
94 |
+
def show_selection(choice):
|
95 |
+
return f"You selected: {choice}"
|
96 |
+
|
97 |
+
dropdown.change(show_selection, inputs=[dropdown], outputs=[output])
|
98 |
+
|
99 |
day = gr.Textbox(label="Day")
|
100 |
date = gr.Textbox(label="Date (YYYY-MM-DD)")
|
101 |
status = gr.Radio(["Present", "Absent"], label="Status")
|