Spaces:
Sleeping
Sleeping
Commit ·
b01cc1b
1
Parent(s): d08ab55
Add manual Year and Month dropdowns for Marksheet aliases
Browse files
app.py
CHANGED
|
@@ -439,15 +439,18 @@ with gr.Blocks(title="School Name Resolver") as app:
|
|
| 439 |
|
| 440 |
with gr.Column(scale=1):
|
| 441 |
marksheet_input = gr.Textbox(label="Marksheet Name", placeholder="Enter exact name to map...", max_lines=1)
|
|
|
|
|
|
|
|
|
|
| 442 |
map_btn = gr.Button("Save Alias", elem_classes="btn-map")
|
| 443 |
status_text = gr.Textbox(show_label=False, interactive=False, visible=False, elem_classes="map-status", max_lines=1)
|
| 444 |
|
| 445 |
-
def on_map_inline(u, m, trigger_val, d=details):
|
| 446 |
m = m.strip()
|
| 447 |
if not m: return gr.update(visible=True, value="⚠️ Enter a name."), trigger_val
|
| 448 |
|
| 449 |
-
|
| 450 |
-
entries = [{"udise_code": u, "alias_name": m, "source_label": "Marksheet", "year_month":
|
| 451 |
|
| 452 |
seen = {m.upper()}
|
| 453 |
for r in d:
|
|
@@ -466,7 +469,7 @@ with gr.Blocks(title="School Name Resolver") as app:
|
|
| 466 |
|
| 467 |
map_btn.click(
|
| 468 |
fn=on_map_inline,
|
| 469 |
-
inputs=[gr.State(udise), marksheet_input, render_trigger],
|
| 470 |
outputs=[status_text, render_trigger]
|
| 471 |
)
|
| 472 |
|
|
|
|
| 439 |
|
| 440 |
with gr.Column(scale=1):
|
| 441 |
marksheet_input = gr.Textbox(label="Marksheet Name", placeholder="Enter exact name to map...", max_lines=1)
|
| 442 |
+
with gr.Row():
|
| 443 |
+
month_input = gr.Dropdown(label="Month", choices=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], value=datetime.now().strftime("%b"))
|
| 444 |
+
year_input = gr.Dropdown(label="Year", choices=[str(y) for y in range(2000, datetime.now().year + 2)], value=str(datetime.now().year))
|
| 445 |
map_btn = gr.Button("Save Alias", elem_classes="btn-map")
|
| 446 |
status_text = gr.Textbox(show_label=False, interactive=False, visible=False, elem_classes="map-status", max_lines=1)
|
| 447 |
|
| 448 |
+
def on_map_inline(u, m, month_val, year_val, trigger_val, d=details):
|
| 449 |
m = m.strip()
|
| 450 |
if not m: return gr.update(visible=True, value="⚠️ Enter a name."), trigger_val
|
| 451 |
|
| 452 |
+
custom_ym = f"{year_val}-{month_val}"
|
| 453 |
+
entries = [{"udise_code": u, "alias_name": m, "source_label": "Marksheet", "year_month": custom_ym}]
|
| 454 |
|
| 455 |
seen = {m.upper()}
|
| 456 |
for r in d:
|
|
|
|
| 469 |
|
| 470 |
map_btn.click(
|
| 471 |
fn=on_map_inline,
|
| 472 |
+
inputs=[gr.State(udise), marksheet_input, month_input, year_input, render_trigger],
|
| 473 |
outputs=[status_text, render_trigger]
|
| 474 |
)
|
| 475 |
|