sharanyaswarup commited on
Commit
3e57ba8
·
1 Parent(s): 5a1766a

Simplify alias mapping UX by using search box value directly

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -438,7 +438,7 @@ with gr.Blocks(title="School Name Resolver") as app:
438
  gr.HTML(build_single_card_html(r, ms_name))
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"), interactive=True, allow_custom_value=True)
444
  year_input = gr.Dropdown(label="Year", choices=[str(y) for y in range(2000, datetime.now().year + 2)], value=str(datetime.now().year), interactive=True, allow_custom_value=True)
@@ -447,7 +447,7 @@ with gr.Blocks(title="School Name Resolver") as app:
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}]
@@ -469,7 +469,7 @@ with gr.Blocks(title="School Name Resolver") as app:
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
 
 
438
  gr.HTML(build_single_card_html(r, ms_name))
439
 
440
  with gr.Column(scale=1):
441
+ # We removed the separate marksheet_input, we will just read directly from school_input!
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"), interactive=True, allow_custom_value=True)
444
  year_input = gr.Dropdown(label="Year", choices=[str(y) for y in range(2000, datetime.now().year + 2)], value=str(datetime.now().year), interactive=True, allow_custom_value=True)
 
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="⚠️ Type a name in the search box above to save!"), 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}]
 
469
 
470
  map_btn.click(
471
  fn=on_map_inline,
472
+ inputs=[gr.State(udise), school_input, month_input, year_input, render_trigger],
473
  outputs=[status_text, render_trigger]
474
  )
475