Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,7 @@ def filter_exams(exam_name, month):
|
|
| 41 |
df = get_exam_data()
|
| 42 |
|
| 43 |
if exam_name:
|
| 44 |
-
df = df[df['Exam Name']
|
| 45 |
|
| 46 |
if month:
|
| 47 |
df = df[df['Plot Date'].dt.month == month]
|
|
@@ -60,11 +60,15 @@ def create_calendar(exam_name=None, month=None):
|
|
| 60 |
fig.update_layout(xaxis_title="Date", yaxis_title="Exam", xaxis=dict(showgrid=False))
|
| 61 |
return fig
|
| 62 |
|
| 63 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
interface = gr.Interface(
|
| 65 |
fn=create_calendar,
|
| 66 |
inputs=[
|
| 67 |
-
gr.
|
| 68 |
gr.Slider(1, 12, step=1, label="Filter by Month (1 = January, 12 = December)")
|
| 69 |
],
|
| 70 |
outputs=gr.Plot(label="Exam Calendar"),
|
|
|
|
| 41 |
df = get_exam_data()
|
| 42 |
|
| 43 |
if exam_name:
|
| 44 |
+
df = df[df['Exam Name'] == exam_name]
|
| 45 |
|
| 46 |
if month:
|
| 47 |
df = df[df['Plot Date'].dt.month == month]
|
|
|
|
| 60 |
fig.update_layout(xaxis_title="Date", yaxis_title="Exam", xaxis=dict(showgrid=False))
|
| 61 |
return fig
|
| 62 |
|
| 63 |
+
# Get the list of unique exam names for the dropdown
|
| 64 |
+
exam_names = get_exam_data()['Exam Name'].unique().tolist()
|
| 65 |
+
exam_names.insert(0, "All Exams") # Add an option to view all exams
|
| 66 |
+
|
| 67 |
+
# Create the Gradio interface with dropdown for exam filter and calendar view
|
| 68 |
interface = gr.Interface(
|
| 69 |
fn=create_calendar,
|
| 70 |
inputs=[
|
| 71 |
+
gr.Dropdown(choices=exam_names, label="Filter by Exam Name"),
|
| 72 |
gr.Slider(1, 12, step=1, label="Filter by Month (1 = January, 12 = December)")
|
| 73 |
],
|
| 74 |
outputs=gr.Plot(label="Exam Calendar"),
|