QIDNLF commited on
Commit
255579c
ยท
verified ยท
1 Parent(s): bb7735c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -355,7 +355,7 @@ def fetch_database_records(standard, version, selection, table_type):
355
  return pd.DataFrame({"Error": [str(e)]}), []
356
 
357
 
358
- def execute_unified_search(base_std, base_ver, base_cat, comp_std, comp_ver, comp_cat):
359
  try:
360
  def get_type_by_cat(cat):
361
  if not cat or cat == "ALL": return "Main"
@@ -520,6 +520,10 @@ def execute_unified_search(base_std, base_ver, base_cat, comp_std, comp_ver, com
520
 
521
  # ๋น„๊ต ์กฐํšŒ ์‹œ์—๋Š” ๋ฒˆํ˜ธ์™€ ์„ค๋ช…์„ ํ•ฉ์นฉ๋‹ˆ๋‹ค
522
  final_df = combine_code_desc(pd.DataFrame(result_rows))
 
 
 
 
523
 
524
  b_cols_final = [c for c in final_df.columns if c.endswith(f"_{base_ver}")]
525
  c_cols_final = [c for c in final_df.columns if c.endswith(f"_{comp_ver}")]
@@ -558,6 +562,9 @@ with gr.Blocks() as demo:
558
  comp_version = gr.Dropdown(label="Version", choices=[])
559
  comp_category = gr.Dropdown(label="Category", choices=[])
560
 
 
 
 
561
  search_btn = gr.Button("๐Ÿ” ์กฐํšŒ", variant="primary")
562
  output_df = gr.Dataframe(wrap=True, interactive=False, datatype="html", max_height=800)
563
 
@@ -575,7 +582,13 @@ with gr.Blocks() as demo:
575
 
576
  search_btn.click(
577
  fn=execute_unified_search,
578
- inputs=[base_standard, base_version, base_category, comp_standard, comp_version, comp_category],
 
 
 
 
 
 
579
  outputs=[output_df]
580
  )
581
 
 
355
  return pd.DataFrame({"Error": [str(e)]}), []
356
 
357
 
358
+ def execute_unified_search(base_std, base_ver, base_cat, comp_std, comp_ver, comp_cat, diff_only):
359
  try:
360
  def get_type_by_cat(cat):
361
  if not cat or cat == "ALL": return "Main"
 
520
 
521
  # ๋น„๊ต ์กฐํšŒ ์‹œ์—๋Š” ๋ฒˆํ˜ธ์™€ ์„ค๋ช…์„ ํ•ฉ์นฉ๋‹ˆ๋‹ค
522
  final_df = combine_code_desc(pd.DataFrame(result_rows))
523
+
524
+ if diff_only:
525
+ mask = final_df.astype(str).apply(lambda col: col.str.contains('color:#ff4d4f|color:#2ecc71', case=False, regex=True)).any(axis=1)
526
+ final_df = final_df[mask]
527
 
528
  b_cols_final = [c for c in final_df.columns if c.endswith(f"_{base_ver}")]
529
  c_cols_final = [c for c in final_df.columns if c.endswith(f"_{comp_ver}")]
 
562
  comp_version = gr.Dropdown(label="Version", choices=[])
563
  comp_category = gr.Dropdown(label="Category", choices=[])
564
 
565
+ with gr.Row()
566
+ diff_filter_cb = gr.Checkbox(label="๐Ÿ’ก ๋ณ€๊ฒฝ๋œ ๋‚ด์šฉ๋งŒ ๋ณด๊ธฐ (Diff Only)", value=False)
567
+
568
  search_btn = gr.Button("๐Ÿ” ์กฐํšŒ", variant="primary")
569
  output_df = gr.Dataframe(wrap=True, interactive=False, datatype="html", max_height=800)
570
 
 
582
 
583
  search_btn.click(
584
  fn=execute_unified_search,
585
+ inputs=[base_standard, base_version, base_category, comp_standard, comp_version, comp_category, diff_filter_cb],
586
+ outputs=[output_df]
587
+ )
588
+
589
+ diff_filter_cb.change(
590
+ fn=execute_unified_search,
591
+ inputs=[base_standard, base_version, base_category, comp_standard, comp_version, comp_category, diff_filter_cb],
592
  outputs=[output_df]
593
  )
594