jin2li commited on
Commit
aba3b79
ยท
verified ยท
1 Parent(s): 004f46d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +172 -47
app.py CHANGED
@@ -706,7 +706,6 @@ def extract_terms_for_mfds_live(row_items):
706
  value = safe_str(value)
707
  if value and len(normalize_compact(value)) >= 3:
708
  terms.append(value)
709
-
710
  seen = set()
711
  unique = []
712
  for term in terms:
@@ -723,7 +722,7 @@ def mfds_live_visible_text(page):
723
  soup = BeautifulSoup(html, "html.parser")
724
  for tag in soup(["script", "style", "nav", "footer", "header"]):
725
  tag.decompose()
726
- return soup.get_text(separator="\n")
727
  except Exception:
728
  try:
729
  return page.locator("body").inner_text(timeout=5000)
@@ -758,9 +757,144 @@ def mfds_live_click_search(page):
758
  return True
759
  except Exception:
760
  pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
761
 
762
- selectors = ["button:has-text('๊ฒ€์ƒ‰')", "a:has-text('๊ฒ€์ƒ‰')", "input[type='submit']", "button[type='submit']", ".btn_search", "#btnSearch", "button"]
763
- for
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
764
 
765
 
766
  # ============================================================
@@ -1920,7 +2054,7 @@ def style_output_workbook(path):
1920
  # 12. ๋ฉ”์ธ ์ฒ˜๋ฆฌ
1921
  # ============================================================
1922
 
1923
- def process(countries, file, product_name="", use_mfds_db=True):
1924
  global RAW_SEARCH_LOGS
1925
  RAW_SEARCH_LOGS = []
1926
 
@@ -1937,7 +2071,8 @@ def process(countries, file, product_name="", use_mfds_db=True):
1937
 
1938
  ingredient_totals = meta["ingredient_totals"]
1939
  ingredient_amount_parts = meta["ingredient_amount_parts"]
1940
- mfds_df = load_mfds_detail_db() if use_mfds_db else pd.DataFrame()
 
1941
 
1942
  llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
1943
 
@@ -1959,6 +2094,18 @@ def process(countries, file, product_name="", use_mfds_db=True):
1959
  }
1960
  row_items.append({"target_id": target_id, "material": material, "component": comp, "row_data": row_data, "notes": []})
1961
 
 
 
 
 
 
 
 
 
 
 
 
 
1962
  for country in countries:
1963
  col_name = display_country(country)
1964
  gpt_targets = []
@@ -1974,7 +2121,7 @@ def process(countries, file, product_name="", use_mfds_db=True):
1974
  continue
1975
 
1976
  mfds_result = None
1977
- if use_mfds_db and mfds_df is not None and not mfds_df.empty:
1978
  mfds_result = evaluate_mfds_detail_rule(country, item["material"], item["component"], mfds_df)
1979
 
1980
  if mfds_result is not None:
@@ -2035,12 +2182,13 @@ def process(countries, file, product_name="", use_mfds_db=True):
2035
  f"- ์ „์„ฑ๋ถ„ ํ–‰ ์ˆ˜: {len(formula_df)}๊ฐœ\n"
2036
  f"- In formula ํ•ฉ๊ณ„: {format_amount(formula_total)}%\n"
2037
  f"- ์žฌ๊ฒ€ํ†  ํ•„์š” ์„ฑ๋ถ„: {issue_count}๊ฐœ\n"
2038
- f"- MFDS ์ƒ์„ธ DB ํ–‰ ์ˆ˜: {mfds_count}๊ฐœ\n"
2039
  "- ๊ฒฐ๊ณผ ํŒŒ์ผ์€ 3๊ฐœ ์‹œํŠธ๋กœ ์ €์žฅํ–ˆ์Šต๋‹ˆ๋‹ค.\n"
2040
  " 1) Formula Ingredients Statement: ์›๋ณธ ์–‘์‹ ์ „์„ฑ๋ถ„ํ‘œ + ๊ตญ๊ฐ€๋ณ„ ์งง์€ ํŒ์ •\n"
2041
  " 2) Regulatory Screening Summary: ๋ฌธ์ œ ์žˆ๋Š” ์„ฑ๋ถ„๋งŒ ๊ตญ๊ฐ€๋ณ„ ์š”์•ฝ\n"
2042
  " 3) Raw Search Log: ๋กœ์ปฌ ๊ทœ์น™/MFDS/GPT ๊ฒ€์ƒ‰ ๊ทผ๊ฑฐ ๋กœ๊ทธ\n"
2043
- "- ํŒ์ • ์šฐ์„ ์ˆœ์œ„: ๋กœ์ปฌ ๊ณ ์ • ๊ทœ์น™ โ†’ MFDS ์ƒ์„ธ DB โ†’ ๊ตญ๊ฐ€๋ณ„ FAISS/GPT\n"
 
2044
  "- GPT ํ˜ธ์ถœ ์ „ ๊ฒ€์ƒ‰ ์›๋ฌธ์— ์‹ค์ œ ์„ฑ๋ถ„๋ช…์ด ์—†์œผ๋ฉด GPT๋ฅผ ํ˜ธ์ถœํ•˜์ง€ ์•Š๊ณ  'ํ•ด๋‹น ์ž๋ฃŒ ๋‚ด ์ œํ•œ ๊ทผ๊ฑฐ ์—†์Œ'์œผ๋กœ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.\n"
2045
  "- MergedCell column_letter ์˜ค๋ฅ˜ ์ˆ˜์ • ์™„๋ฃŒ ๋ฒ„์ „์ž…๋‹ˆ๋‹ค.\n"
2046
  "- public share link๊ฐ€ ์ƒ์„ฑ๋˜๋„๋ก share=True๋กœ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค."
@@ -2079,7 +2227,18 @@ with gr.Blocks(css=custom_css) as demo:
2079
 
2080
  file = gr.File(label="์ „์„ฑ๋ถ„ ์—‘์…€ ์—…๋กœ๋“œ", file_types=[".xlsx"])
2081
 
2082
- use_mfds_db = gr.Checkbox(label="MFDS ์ƒ์„ธ DB ์šฐ์„  ๋ฐ˜์˜", value=True)
 
 
 
 
 
 
 
 
 
 
 
2083
 
2084
  btn = gr.Button("๐Ÿš€ ๋ถ„์„ ์‹œ์ž‘", variant="primary")
2085
 
@@ -2096,44 +2255,10 @@ with gr.Blocks(css=custom_css) as demo:
2096
  print(f"์ž๋™ ๊ตญ๊ฐ€ ๋ชฉ๋ก ๊ฐฑ์‹  ํƒ€์ด๋จธ ๋น„ํ™œ์„ฑํ™”: {e}")
2097
 
2098
  file.change(fn=preview_excel, inputs=file, outputs=df_out)
2099
- btn.click(process, inputs=[country, file, product_name, use_mfds_db], outputs=[df_out, file_out, msg_out])
2100
-
2101
- with gr.Tab("๐Ÿ‡ฐ๐Ÿ‡ท MFDS ์ƒ์„ธ DB ๊ด€๋ฆฌ"):
2102
- gr.Markdown(
2103
- """
2104
- ### MFDS ์ƒ์„ธ DB ์‚ฌ์šฉ ๋ฐฉ์‹
2105
-
2106
- ์˜์•ฝํ’ˆ์•ˆ์ „๋‚˜๋ผ ์‚ฌ์ดํŠธ๋Š” ์ž๋™ ์ ‘์†์ด ๋ง‰ํžˆ๊ฑฐ๋‚˜ ๋™์  ํŽ˜์ด์ง€ ๋ฌธ์ œ๋กœ ๋ถˆ์•ˆ์ •ํ•  ์ˆ˜ ์žˆ์–ด์„œ,
2107
- ์ด ์•ฑ์—์„œ๋Š” **์‚ฌ์ดํŠธ ์‹ค์‹œ๊ฐ„ ํฌ๋กค๋ง ๋Œ€์‹  ์ƒ์„ธ์ •๋ณด ์—‘์…€ DB ๋ฐฉ์‹**์œผ๋กœ ์—ฐ๋™ํ•ฉ๋‹ˆ๋‹ค.
2108
-
2109
- ์—‘์…€ ํŒŒ์ผ๋ช…์€ ์ž๋™์œผ๋กœ ์•„๋ž˜ ์ด๋ฆ„์œผ๋กœ ์ €์žฅ๋ฉ๋‹ˆ๋‹ค.
2110
-
2111
- `MFDS_๊ตญ๊ฐ€๋ณ„_๊ธˆ์ง€์ œํ•œ_์ƒ์„ธ.xlsx`
2112
-
2113
- ํ•„์ˆ˜ ์ปฌ๋Ÿผ:
2114
- - ์›๋ฃŒ๋ช…
2115
- - INCI
2116
- - CAS.No
2117
- - ๊ตฌ๋ถ„
2118
- - ๊ตญ๊ฐ€
2119
- - ๊ทœ์ œ๋‚ด์šฉ
2120
- - ํ•œ๋„
2121
- - ์กฐ๊ฑด
2122
- - ์ถœ์ฒ˜
2123
- - ์ƒ์„ธ์›๋ฌธ
2124
- """
2125
- )
2126
-
2127
- template_btn = gr.Button("๐Ÿ“„ MFDS ์ƒ์„ธ DB ํ…œํ”Œ๋ฆฟ ๋‹ค์šด๋กœ๋“œ")
2128
- template_file = gr.File(label="ํ…œํ”Œ๋ฆฟ ๋‹ค์šด๋กœ๋“œ")
2129
- template_msg = gr.Textbox(label="ํ…œํ”Œ๋ฆฟ ์ƒํƒœ", interactive=False, lines=3)
2130
- template_btn.click(download_mfds_template, inputs=[], outputs=[template_file, template_msg])
2131
 
2132
- mfds_upload = gr.File(label="MFDS ์ƒ์„ธ DB ์—‘์…€ ์—…๋กœ๋“œ", file_types=[".xlsx"])
2133
- mfds_save_btn = gr.Button("๐Ÿ“ฅ ์—…๋กœ๋“œ ์—‘์…€์„ MFDS ์ƒ์„ธ DB๋กœ ์ €์žฅ", variant="primary")
2134
- mfds_db_file = gr.File(label="ํ˜„์žฌ MFDS ์ƒ์„ธ DB ๋‹ค์šด๋กœ๋“œ")
2135
- mfds_db_msg = gr.Textbox(label="MFDS DB ์ƒํƒœ", lines=8, interactive=False)
2136
- mfds_save_btn.click(upload_mfds_db, inputs=mfds_upload, outputs=[mfds_db_file, mfds_db_msg])
2137
 
2138
 
2139
  # ============================================================
 
706
  value = safe_str(value)
707
  if value and len(normalize_compact(value)) >= 3:
708
  terms.append(value)
 
709
  seen = set()
710
  unique = []
711
  for term in terms:
 
722
  soup = BeautifulSoup(html, "html.parser")
723
  for tag in soup(["script", "style", "nav", "footer", "header"]):
724
  tag.decompose()
725
+ return soup.get_text(separator=" ")
726
  except Exception:
727
  try:
728
  return page.locator("body").inner_text(timeout=5000)
 
757
  return True
758
  except Exception:
759
  pass
760
+ for selector in ["button", "input[type='submit']", "a"]:
761
+ try:
762
+ loc = page.locator(selector)
763
+ for i in range(min(loc.count(), 20)):
764
+ item = loc.nth(i)
765
+ try:
766
+ text = item.inner_text(timeout=500) if selector != "input[type='submit']" else "๊ฒ€์ƒ‰"
767
+ if "๊ฒ€์ƒ‰" in text or selector == "input[type='submit']":
768
+ item.click(timeout=3000)
769
+ return True
770
+ except Exception:
771
+ continue
772
+ except Exception:
773
+ continue
774
+ return False
775
 
776
+
777
+ def mfds_live_click_result_row(page, term):
778
+ term_norm = normalize_compact(term)
779
+ for selector in ["table tbody tr", "tbody tr", "tr"]:
780
+ try:
781
+ rows = page.locator(selector)
782
+ for i in range(min(rows.count(), 30)):
783
+ row = rows.nth(i)
784
+ try:
785
+ row_text = row.inner_text(timeout=1000)
786
+ except Exception:
787
+ continue
788
+ if term_norm and term_norm in normalize_compact(row_text):
789
+ row.click(timeout=3000)
790
+ page.wait_for_timeout(1500)
791
+ return True
792
+ except Exception:
793
+ continue
794
+ try:
795
+ loc = page.get_by_text(term, exact=False)
796
+ if loc.count() > 0:
797
+ loc.first.click(timeout=3000)
798
+ page.wait_for_timeout(1500)
799
+ return True
800
+ except Exception:
801
+ pass
802
+ return False
803
+
804
+
805
+ def parse_mfds_live_text(term, text):
806
+ clean = " ".join(safe_str(text).split())
807
+ if not clean:
808
+ return []
809
+ lower_clean = clean.lower()
810
+ country_patterns = {
811
+ "EU": ["eu", "์œ ๋Ÿฝ", "์œ ๋Ÿฝ์—ฐํ•ฉ", "european union", "europe"],
812
+ "๋ฏธ๊ตญ": ["๋ฏธ๊ตญ", "usa", "fda", "united states"],
813
+ "์ผ๋ณธ": ["์ผ๋ณธ", "japan"],
814
+ "์ค‘๊ตญ": ["์ค‘๊ตญ", "china"],
815
+ "ASEAN": ["asean", "์•„์„ธ์•ˆ"],
816
+ "ํ•œ๊ตญ": ["ํ•œ๊ตญ", "๋Œ€ํ•œ๋ฏผ๊ตญ", "korea"],
817
+ "์˜๊ตญ": ["์˜๊ตญ", "uk", "united kingdom"],
818
+ }
819
+ rows = []
820
+ for country, aliases in country_patterns.items():
821
+ found_index = -1
822
+ for alias in aliases:
823
+ idx = lower_clean.find(alias)
824
+ if idx >= 0:
825
+ found_index = idx
826
+ break
827
+ if found_index < 0:
828
+ continue
829
+ start = max(0, found_index - 350)
830
+ end = min(len(clean), found_index + 1000)
831
+ snippet = clean[start:end]
832
+ snippet_lower = snippet.lower()
833
+ category = "์ œํ•œ"
834
+ if any(k in snippet_lower for k in ["๊ธˆ์ง€", "์‚ฌ์šฉ๊ธˆ์ง€", "๋ฐฐํ•ฉ๊ธˆ์ง€", "prohibited", "banned", "not allowed"]):
835
+ category = "๊ธˆ์ง€"
836
+ rows.append({
837
+ "์›๋ฃŒ๋ช…": term,
838
+ "INCI": term,
839
+ "CAS.No": "",
840
+ "๊ตฌ๋ถ„": category,
841
+ "๊ตญ๊ฐ€": country,
842
+ "๊ทœ์ œ๋‚ด์šฉ": snippet[:500],
843
+ "ํ•œ๋„": "",
844
+ "์กฐ๊ฑด": "",
845
+ "์ถœ์ฒ˜": "MFDS live: " + MFDS_LIVE_URL,
846
+ "์ƒ์„ธ์›๋ฌธ": clean[:5000],
847
+ })
848
+ return rows
849
+
850
+
851
+ def mfds_live_lookup_terms(terms, max_terms=30, headless=True):
852
+ if not PLAYWRIGHT_AVAILABLE:
853
+ return pd.DataFrame(), "playwright ๋ฏธ์„ค์น˜: pip install playwright && python -m playwright install chromium ํ•„์š”"
854
+ terms = [safe_str(t) for t in terms if safe_str(t)]
855
+ terms = terms[:int(max_terms)] if max_terms else terms[:30]
856
+ all_rows = []
857
+ errors = []
858
+ try:
859
+ with sync_playwright() as p:
860
+ browser = p.chromium.launch(headless=bool(headless))
861
+ context = browser.new_context(viewport={"width": 1400, "height": 1000}, user_agent="Mozilla/5.0 reBom Regulatory Screening")
862
+ page = context.new_page()
863
+ for idx, term in enumerate(terms, start=1):
864
+ try:
865
+ print(f"MFDS ์‹ค์‹œ๊ฐ„ ์กฐํšŒ {idx}/{len(terms)}: {term}")
866
+ page.goto(MFDS_LIVE_URL, wait_until="domcontentloaded", timeout=30000)
867
+ page.wait_for_timeout(2000)
868
+ if not mfds_live_fill_search_input(page, term):
869
+ errors.append(f"{term}: ๊ฒ€์ƒ‰ ์ž…๋ ฅ์ฐฝ ์ฐพ๊ธฐ ์‹คํŒจ")
870
+ continue
871
+ if not mfds_live_click_search(page):
872
+ try:
873
+ page.keyboard.press("Enter")
874
+ except Exception:
875
+ pass
876
+ page.wait_for_timeout(2500)
877
+ mfds_live_click_result_row(page, term)
878
+ page.wait_for_timeout(1500)
879
+ text = mfds_live_visible_text(page)
880
+ rows = parse_mfds_live_text(term, text)
881
+ if rows:
882
+ all_rows.extend(rows)
883
+ else:
884
+ errors.append(f"{term}: ๊ตญ๊ฐ€๋ณ„ ์ƒ์„ธ์ •๋ณด ๋ฏธ๊ฒ€์ถœ")
885
+ except Exception as e:
886
+ errors.append(f"{term}: {e}")
887
+ context.close()
888
+ browser.close()
889
+ except Exception as e:
890
+ return pd.DataFrame(), f"MFDS ๋ธŒ๋ผ์šฐ์ € ์‹คํ–‰ ์‹คํŒจ: {e}"
891
+ df = pd.DataFrame(all_rows)
892
+ msg = f"MFDS ์‹ค์‹œ๊ฐ„ ์กฐํšŒ ์™„๋ฃŒ: ๊ฒ€์ƒ‰์–ด {len(terms)}๊ฐœ, ๊ฒฐ๊ณผ {len(df)}ํ–‰"
893
+ if errors:
894
+ msg += " / ์ผ๋ถ€ ์‹คํŒจ: " + " ; ".join(errors[:5])
895
+ if len(errors) > 5:
896
+ msg += f" ์™ธ {len(errors) - 5}๊ฑด"
897
+ return df, msg
898
 
899
 
900
  # ============================================================
 
2054
  # 12. ๋ฉ”์ธ ์ฒ˜๋ฆฌ
2055
  # ============================================================
2056
 
2057
+ def process(countries, file, product_name="", use_mfds_live=False, mfds_max_terms=30, mfds_headless=True):
2058
  global RAW_SEARCH_LOGS
2059
  RAW_SEARCH_LOGS = []
2060
 
 
2071
 
2072
  ingredient_totals = meta["ingredient_totals"]
2073
  ingredient_amount_parts = meta["ingredient_amount_parts"]
2074
+ mfds_df = pd.DataFrame()
2075
+ mfds_live_msg = ""
2076
 
2077
  llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
2078
 
 
2094
  }
2095
  row_items.append({"target_id": target_id, "material": material, "component": comp, "row_data": row_data, "notes": []})
2096
 
2097
+ if use_mfds_live:
2098
+ try:
2099
+ terms = extract_terms_for_mfds_live(row_items)
2100
+ mfds_df, mfds_live_msg = mfds_live_lookup_terms(
2101
+ terms=terms,
2102
+ max_terms=mfds_max_terms,
2103
+ headless=mfds_headless,
2104
+ )
2105
+ except Exception as e:
2106
+ mfds_df = pd.DataFrame()
2107
+ mfds_live_msg = f"MFDS ์‹ค์‹œ๊ฐ„ ์กฐํšŒ ์‹คํŒจ: {e}"
2108
+
2109
  for country in countries:
2110
  col_name = display_country(country)
2111
  gpt_targets = []
 
2121
  continue
2122
 
2123
  mfds_result = None
2124
+ if use_mfds_live and mfds_df is not None and not mfds_df.empty:
2125
  mfds_result = evaluate_mfds_detail_rule(country, item["material"], item["component"], mfds_df)
2126
 
2127
  if mfds_result is not None:
 
2182
  f"- ์ „์„ฑ๋ถ„ ํ–‰ ์ˆ˜: {len(formula_df)}๊ฐœ\n"
2183
  f"- In formula ํ•ฉ๊ณ„: {format_amount(formula_total)}%\n"
2184
  f"- ์žฌ๊ฒ€ํ†  ํ•„์š” ์„ฑ๋ถ„: {issue_count}๊ฐœ\n"
2185
+ f"- MFDS ์‹ค์‹œ๊ฐ„ ์กฐํšŒ ๊ฒฐ๊ณผ ํ–‰ ์ˆ˜: {mfds_count}๊ฐœ\n"
2186
  "- ๊ฒฐ๊ณผ ํŒŒ์ผ์€ 3๊ฐœ ์‹œํŠธ๋กœ ์ €์žฅํ–ˆ์Šต๋‹ˆ๋‹ค.\n"
2187
  " 1) Formula Ingredients Statement: ์›๋ณธ ์–‘์‹ ์ „์„ฑ๋ถ„ํ‘œ + ๊ตญ๊ฐ€๋ณ„ ์งง์€ ํŒ์ •\n"
2188
  " 2) Regulatory Screening Summary: ๋ฌธ์ œ ์žˆ๋Š” ์„ฑ๋ถ„๋งŒ ๊ตญ๊ฐ€๋ณ„ ์š”์•ฝ\n"
2189
  " 3) Raw Search Log: ๋กœ์ปฌ ๊ทœ์น™/MFDS/GPT ๊ฒ€์ƒ‰ ๊ทผ๊ฑฐ ๋กœ๊ทธ\n"
2190
+ "- ํŒ์ • ์šฐ์„ ์ˆœ์œ„: ๋กœ์ปฌ ๊ณ ์ • ๊ทœ์น™ โ†’ MFDS ์‹ค์‹œ๊ฐ„ ์กฐํšŒ โ†’ ๊ตญ๊ฐ€๋ณ„ FAISS/GPT\n"
2191
+ f"- MFDS ์ƒํƒœ: {mfds_live_msg or '์‚ฌ์šฉ ์•ˆ ํ•จ'}\n"
2192
  "- GPT ํ˜ธ์ถœ ์ „ ๊ฒ€์ƒ‰ ์›๋ฌธ์— ์‹ค์ œ ์„ฑ๋ถ„๋ช…์ด ์—†์œผ๋ฉด GPT๋ฅผ ํ˜ธ์ถœํ•˜์ง€ ์•Š๊ณ  'ํ•ด๋‹น ์ž๋ฃŒ ๋‚ด ์ œํ•œ ๊ทผ๊ฑฐ ์—†์Œ'์œผ๋กœ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.\n"
2193
  "- MergedCell column_letter ์˜ค๋ฅ˜ ์ˆ˜์ • ์™„๋ฃŒ ๋ฒ„์ „์ž…๋‹ˆ๋‹ค.\n"
2194
  "- public share link๊ฐ€ ์ƒ์„ฑ๋˜๋„๋ก share=True๋กœ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค."
 
2227
 
2228
  file = gr.File(label="์ „์„ฑ๋ถ„ ์—‘์…€ ์—…๋กœ๋“œ", file_types=[".xlsx"])
2229
 
2230
+ use_mfds_live = gr.Checkbox(label="์‹์•ฝ์ฒ˜ ์‚ฌ์ดํŠธ ์‹ค์‹œ๊ฐ„ ์กฐํšŒ ์‚ฌ์šฉ", value=False)
2231
+
2232
+ mfds_max_terms = gr.Number(
2233
+ label="์‹์•ฝ์ฒ˜ ์‹ค์‹œ๊ฐ„ ์กฐํšŒ ์ตœ๋Œ€ ๊ฒ€์ƒ‰์–ด ์ˆ˜",
2234
+ value=30,
2235
+ precision=0,
2236
+ )
2237
+
2238
+ mfds_headless = gr.Checkbox(
2239
+ label="์‹์•ฝ์ฒ˜ ์กฐํšŒ ๋ธŒ๋ผ์šฐ์ € ์ˆจ๊น€ ๋ชจ๋“œ",
2240
+ value=True,
2241
+ )
2242
 
2243
  btn = gr.Button("๐Ÿš€ ๋ถ„์„ ์‹œ์ž‘", variant="primary")
2244
 
 
2255
  print(f"์ž๋™ ๊ตญ๊ฐ€ ๋ชฉ๋ก ๊ฐฑ์‹  ํƒ€์ด๋จธ ๋น„ํ™œ์„ฑํ™”: {e}")
2256
 
2257
  file.change(fn=preview_excel, inputs=file, outputs=df_out)
2258
+ btn.click(process, inputs=[country, file, product_name, use_mfds_live, mfds_max_terms, mfds_headless], outputs=[df_out, file_out, msg_out])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2259
 
2260
+ # MFDS ์—‘์…€ DB ๊ด€๋ฆฌ ํƒญ์€ ์ œ๊ฑฐํ–ˆ์Šต๋‹ˆ๋‹ค.
2261
+ # ์‹์•ฝ์ฒ˜ ์ •๋ณด๋Š” ์Šคํฌ๋ฆฌ๋‹ ํƒญ์˜ '์‹์•ฝ์ฒ˜ ์‚ฌ์ดํŠธ ์‹ค์‹œ๊ฐ„ ์กฐํšŒ ์‚ฌ์šฉ' ์˜ต์…˜์œผ๋กœ๋งŒ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
 
 
 
2262
 
2263
 
2264
  # ============================================================