jin2li commited on
Commit
6da0bee
ยท
verified ยท
1 Parent(s): 762d3b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +85 -197
app.py CHANGED
@@ -10,6 +10,7 @@ from langchain_community.vectorstores import FAISS
10
  from langchain_text_splitters import RecursiveCharacterTextSplitter
11
 
12
 
 
13
  api_key = os.getenv("OPENAI_API_KEY")
14
  if not api_key:
15
  print("โŒ OPENAI_API_KEY๊ฐ€ ์„ค์ •๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.")
@@ -17,41 +18,33 @@ else:
17
  print("โœ… OPENAI_API_KEY๊ฐ€ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.")
18
 
19
 
 
20
  def get_country_folders():
21
  exclude = [".git", ".cache", "__pycache__", ".ipynb_checkpoints"]
22
- folders = [
23
- f for f in os.listdir(".")
24
- if os.path.isdir(f) and f not in exclude
25
- ]
26
  return folders if folders else ["ํด๋” ์—†์Œ"]
27
 
28
 
 
29
  def preview_excel(excel_file):
30
  if not excel_file:
31
  return None
32
-
33
  try:
34
- df = pd.read_excel(excel_file.name)
35
- return df
36
  except Exception as e:
37
- return pd.DataFrame({"์˜ค๋ฅ˜": [f"์—‘์…€ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์˜ค๋ฅ˜: {str(e)}"]})
38
 
39
 
 
40
  def build_database(country_folder):
41
  if country_folder == "ํด๋” ์—†์Œ":
42
  return None
43
 
44
  all_texts = []
45
- text_splitter = RecursiveCharacterTextSplitter(
46
- chunk_size=800,
47
- chunk_overlap=100
48
- )
49
 
50
  path = f"./{country_folder}"
51
- files = [
52
- f for f in os.listdir(path)
53
- if f.lower().endswith(".pdf")
54
- ]
55
 
56
  if not files:
57
  return None
@@ -62,14 +55,9 @@ def build_database(country_folder):
62
  for page in pdf.pages:
63
  text = page.extract_text()
64
  if text:
65
- chunks = text_splitter.split_text(
66
- f"[์ถœ์ฒ˜: {filename}] {text}"
67
- )
68
- all_texts.extend(chunks)
69
-
70
  except Exception as e:
71
- print(f"PDF ์ฝ๊ธฐ ์˜ค๋ฅ˜: {filename} / {e}")
72
- continue
73
 
74
  if not all_texts:
75
  return None
@@ -78,219 +66,119 @@ def build_database(country_folder):
78
  return FAISS.from_texts(all_texts, embeddings)
79
 
80
 
81
- def style_excel(out_path):
82
- wb = load_workbook(out_path)
 
83
  ws = wb.active
84
 
85
- red_fill = PatternFill(start_color="FFC7CE", end_color="FFC7CE", fill_type="solid")
86
- yellow_fill = PatternFill(start_color="FFF2CC", end_color="FFF2CC", fill_type="solid")
87
- header_fill = PatternFill(start_color="D9EAF7", end_color="D9EAF7", fill_type="solid")
88
-
89
- for cell in ws[1]:
90
- cell.fill = header_fill
91
- cell.font = Font(bold=True)
92
- cell.alignment = Alignment(horizontal="center", vertical="center")
93
 
94
- headers = [cell.value for cell in ws[1]]
95
  ์ ํ•ฉ_col = headers.index("์ ํ•ฉ ์—ฌ๋ถ€") + 1
96
  ๊ทœ์ œ_col = headers.index("๊ทœ์ œ ์ •๋„") + 1
97
 
98
  for row in range(2, ws.max_row + 1):
99
- ์ ํ•ฉ๊ฐ’ = str(ws.cell(row=row, column=์ ํ•ฉ_col).value or "")
100
- ๊ทœ์ œ๊ฐ’ = str(ws.cell(row=row, column=๊ทœ์ œ_col).value or "")
101
-
102
- if "๋ถ€์ ํ•ฉ" in ์ ํ•ฉ๊ฐ’:
103
- for col in range(1, ws.max_column + 1):
104
- ws.cell(row=row, column=col).fill = red_fill
105
-
106
- elif "ํ™•์ธ ํ•„์š”" in ์ ํ•ฉ๊ฐ’ or ("์ •๋ณด ์—†์Œ" not in ๊ทœ์ œ๊ฐ’ and ๊ทœ์ œ๊ฐ’.strip()):
107
- for col in range(1, ws.max_column + 1):
108
- ws.cell(row=row, column=col).fill = yellow_fill
109
-
110
- for col in ws.columns:
111
- max_length = 0
112
- col_letter = col[0].column_letter
113
 
114
- for cell in col:
115
- cell.alignment = Alignment(
116
- vertical="top",
117
- wrap_text=True
118
- )
119
- if cell.value:
120
- max_length = max(max_length, len(str(cell.value)))
121
 
122
- ws.column_dimensions[col_letter].width = min(max(max_length + 2, 12), 45)
 
 
123
 
124
- ws.freeze_panes = "A2"
125
- wb.save(out_path)
126
 
127
 
 
128
  def process_screening(country, excel_file):
129
  if not excel_file:
130
- return None, "โŒ ์—‘์…€ ํŒŒ์ผ์„ ์—…๋กœ๋“œํ•ด์ฃผ์„ธ์š”."
131
-
132
- if country == "ํด๋” ์—†์Œ":
133
- return None, "โŒ ๊ตญ๊ฐ€ ํด๋”๋ฅผ ๋จผ์ € ์ƒ์„ฑํ•˜๊ณ  PDF๋ฅผ ๋„ฃ์–ด์ฃผ์„ธ์š”."
134
-
135
- try:
136
- vector_db = build_database(country)
137
-
138
- if not vector_db:
139
- return None, f"โŒ {country} ํด๋” ๋‚ด์— ๋ถ„์„ํ•  PDF ํŒŒ์ผ์ด ์—†์Šต๋‹ˆ๋‹ค."
140
-
141
- llm = ChatOpenAI(
142
- model="gpt-4o-mini",
143
- temperature=0
144
- )
145
-
146
- df = pd.read_excel(excel_file.name)
147
 
148
- ์ ํ•ฉ์—ฌ๋ถ€ = []
149
- ๋ถ€์ ํ•ฉ์‚ฌ์œ  = []
150
- ๊ทœ์ œ๊ฒฐ๊ณผ = []
151
 
152
- for _, row in df.iterrows():
153
- ing_name = str(row.iloc[0]).strip()
154
 
155
- if not ing_name or ing_name.lower() == "nan":
156
- ์ ํ•ฉ์—ฌ๋ถ€.append("ํ™•์ธ ํ•„์š”")
157
- ๋ถ€์ ํ•ฉ์‚ฌ์œ .append("์„ฑ๋ถ„๋ช…์ด ๋น„์–ด ์žˆ์Šต๋‹ˆ๋‹ค.")
158
- ๊ทœ์ œ๊ฒฐ๊ณผ.append("์„ฑ๋ถ„๋ช… ์—†์Œ")
159
- continue
160
 
161
- row_info = row.to_dict()
162
 
163
- try:
164
- docs = vector_db.similarity_search(ing_name, k=3)
165
- context = "\n".join([d.page_content for d in docs])
166
 
167
- prompt = f"""
168
- ๋„ˆ๋Š” ํ™”์žฅํ’ˆ ๊ทœ์ œ ์Šคํฌ๋ฆฌ๋‹ ์ „๋ฌธ๊ฐ€์•ผ.
169
-
170
- ์•„๋ž˜ ์„ฑ๋ถ„๊ณผ ์—‘์…€ ํ–‰ ์ •๋ณด๋ฅผ ๊ธฐ์ค€์œผ๋กœ, ๊ทœ์ œ ์›๋ฌธ์—์„œ ํ™•์ธ๋˜๋Š” ๋‚ด์šฉ์„ ๋ฐ”ํƒ•์œผ๋กœ ํŒ๋‹จํ•ด.
171
-
172
- [์„ฑ๋ถ„๋ช…]
173
- {ing_name}
174
 
175
- [์—‘์…€ ํ–‰ ์ •๋ณด]
176
- {row_info}
 
177
 
178
- [๊ทœ์ œ ์›๋ฌธ]
179
- {context}
180
 
181
- ๋ฐ˜๋“œ์‹œ ์•„๋ž˜ ํ˜•์‹์œผ๋กœ๋งŒ ๋‹ต๋ณ€ํ•ด.
182
 
183
  ์ ํ•ฉ ์—ฌ๋ถ€:
184
  ๋ถ€์ ํ•ฉ ์‚ฌ์œ :
185
  ๊ทœ์ œ ์ •๋„:
186
 
187
- ํŒ๋‹จ ๊ธฐ์ค€:
188
- - ๊ทœ์ œ ์›๋ฌธ์— ๊ธˆ์ง€ ์„ฑ๋ถ„์œผ๋กœ ๋ณด์ด๋ฉด ์ ํ•ฉ ์—ฌ๋ถ€๋Š” '๋ถ€์ ํ•ฉ'
189
- - ๊ทœ์ œ ์›๋ฌธ์— ์‚ฌ์šฉ ํ•œ๋„๋‚˜ ์กฐ๊ฑด์ด ์žˆ๊ณ , ์—‘์…€์— ํ•จ๋Ÿ‰ ์ •๋ณด๊ฐ€ ์žˆ์–ด ๊ธฐ์ค€ ์ดˆ๊ณผ๋ฉด '๋ถ€์ ํ•ฉ'
190
- - ๊ทœ์ œ ์›๋ฌธ์— ์‚ฌ์šฉ ํ•œ๋„๋‚˜ ์กฐ๊ฑด์ด ์žˆ๊ณ , ์—‘์…€์— ํ•จ๋Ÿ‰ ์ •๋ณด๊ฐ€ ์žˆ์–ด ๊ธฐ์ค€ ์ด๋‚ด๋ฉด '์ ํ•ฉ'
191
- - ๊ทœ์ œ ์›๋ฌธ์— ์‚ฌ์šฉ ํ•œ๋„๋‚˜ ์กฐ๊ฑด์ด ์žˆ์œผ๋‚˜ ํ•จ๋Ÿ‰ ์ •๋ณด๊ฐ€ ์—†๊ฑฐ๋‚˜ ๋น„๊ต๊ฐ€ ์–ด๋ ค์šฐ๋ฉด 'ํ™•์ธ ํ•„์š”'
192
- - ๊ทœ์ œ ์›๋ฌธ์— ๊ด€๋ จ ๋‚ด์šฉ์ด ์—†์œผ๋ฉด ์ ํ•ฉ ์—ฌ๋ถ€๋Š” '์ •๋ณด ์—†์Œ'
193
- - ๋ถ€์ ํ•ฉ ์‚ฌ์œ ๋Š” ๋ถ€์ ํ•ฉ์ผ ๋•Œ๋งŒ ์ž‘์„ฑํ•˜๊ณ , ์•„๋‹ˆ๋ฉด '-' ์ž‘์„ฑ
194
- - ๊ทœ์ œ ์ •๋„์—๋Š” ๊ธˆ์ง€ ์—ฌ๋ถ€, ์‚ฌ์šฉ ํ•œ๋„, ์‚ฌ์šฉ ์กฐ๊ฑด์„ ์งง๊ฒŒ ์ž‘์„ฑ
195
  """
196
 
197
- res = llm.invoke(prompt).content
198
 
199
- status = ""
200
- reason = ""
201
- reg = ""
202
 
203
- for line in res.splitlines():
204
- if line.startswith("์ ํ•ฉ ์—ฌ๋ถ€:"):
205
- status = line.replace("์ ํ•ฉ ์—ฌ๋ถ€:", "").strip()
206
- elif line.startswith("๋ถ€์ ํ•ฉ ์‚ฌ์œ :"):
207
- reason = line.replace("๋ถ€์ ํ•ฉ ์‚ฌ์œ :", "").strip()
208
- elif line.startswith("๊ทœ์ œ ์ •๋„:"):
209
- reg = line.replace("๊ทœ์ œ ์ •๋„:", "").strip()
210
 
211
- ์ ํ•ฉ์—ฌ๋ถ€.append(status if status else "ํ™•์ธ ํ•„์š”")
212
- ๋ถ€์ ํ•ฉ์‚ฌ์œ .append(reason if reason else "-")
213
- ๊ทœ์ œ๊ฒฐ๊ณผ.append(reg if reg else "์ •๋ณด ์—†์Œ")
214
 
215
- except Exception as e:
216
- ์ ํ•ฉ์—ฌ๋ถ€.append("ํ™•์ธ ํ•„์š”")
217
- ๋ถ€์ ํ•ฉ์‚ฌ์œ .append(str(e))
218
- ๊ทœ์ œ๊ฒฐ๊ณผ.append(f"์—๋Ÿฌ ๋ฐœ์ƒ: {str(e)}")
219
 
220
- df["์ ํ•ฉ ์—ฌ๋ถ€"] = ์ ํ•ฉ์—ฌ๋ถ€
221
- df["๋ถ€์ ํ•ฉ ์‚ฌ์œ "] = ๋ถ€์ ํ•ฉ์‚ฌ์œ 
222
- df["๊ทœ์ œ ์ •๋„"] = ๊ทœ์ œ๊ฒฐ๊ณผ
223
 
224
- out_path = f"reBom_Result_{country}.xlsx"
225
- df.to_excel(out_path, index=False)
 
226
 
227
- style_excel(out_path)
228
 
229
- return df, out_path
230
 
231
- except Exception as e:
232
- return None, f"โŒ ์ „์ฒด ์ฒ˜๋ฆฌ ์˜ค๋ฅ˜: {str(e)}"
233
-
234
-
235
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
236
- gr.Markdown("# ๐Ÿงช reBom Global Regulatory AI")
237
- gr.Markdown("### ๊ตญ๊ฐ€๋ณ„ ํด๋”๋ฅผ ์„ ํƒํ•˜๊ณ  ์„ฑ๋ถ„๋ช… ์—‘์…€์„ ์—…๋กœ๋“œํ•˜์„ธ์š”.")
238
-
239
- with gr.Row():
240
- country_select = gr.Dropdown(
241
- choices=get_country_folders(),
242
- label="๐ŸŒ ์Šคํฌ๋ฆฌ๋‹ ๊ตญ๊ฐ€ ์„ ํƒ",
243
- value=get_country_folders()[0]
244
- )
245
-
246
- refresh_btn = gr.Button(
247
- "๐Ÿ”„ ํด๋” ์ƒˆ๋กœ๊ณ ์นจ",
248
- variant="secondary",
249
- scale=0
250
- )
251
-
252
- with gr.Row():
253
- f_in = gr.File(
254
- label="์ „์„ฑ๋ถ„ ์—‘์…€ ์—…๋กœ๋“œ (.xlsx)",
255
- file_types=[".xlsx"]
256
- )
257
-
258
- btn = gr.Button(
259
- "๐Ÿš€ ๋ถ„์„ ์‹œ์ž‘",
260
- variant="primary"
261
- )
262
-
263
- with gr.Row():
264
- df_out = gr.Dataframe(
265
- label="๊ฒฐ๊ณผ ๋ฏธ๋ฆฌ๋ณด๊ธฐ",
266
- wrap=True,
267
- interactive=False,
268
- height=500
269
- )
270
-
271
- f_out = gr.File(
272
- label="๊ฒฐ๊ณผ ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ"
273
- )
274
-
275
- refresh_btn.click(
276
- fn=lambda: gr.update(
277
- choices=get_country_folders(),
278
- value=get_country_folders()[0]
279
- ),
280
- outputs=country_select
281
- )
282
-
283
- f_in.change(
284
- fn=preview_excel,
285
- inputs=f_in,
286
- outputs=df_out
287
- )
288
-
289
- btn.click(
290
- process_screening,
291
- inputs=[country_select, f_in],
292
- outputs=[df_out, f_out]
293
- )
294
 
295
 
296
  demo.launch()
 
10
  from langchain_text_splitters import RecursiveCharacterTextSplitter
11
 
12
 
13
+ # API ํ‚ค ํ™•์ธ
14
  api_key = os.getenv("OPENAI_API_KEY")
15
  if not api_key:
16
  print("โŒ OPENAI_API_KEY๊ฐ€ ์„ค์ •๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.")
 
18
  print("โœ… OPENAI_API_KEY๊ฐ€ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.")
19
 
20
 
21
+ # ๊ตญ๊ฐ€ ํด๋” ๊ฐ€์ ธ์˜ค๊ธฐ
22
  def get_country_folders():
23
  exclude = [".git", ".cache", "__pycache__", ".ipynb_checkpoints"]
24
+ folders = [f for f in os.listdir(".") if os.path.isdir(f) and f not in exclude]
 
 
 
25
  return folders if folders else ["ํด๋” ์—†์Œ"]
26
 
27
 
28
+ # ์—‘์…€ ๋ฏธ๋ฆฌ๋ณด๊ธฐ
29
  def preview_excel(excel_file):
30
  if not excel_file:
31
  return None
 
32
  try:
33
+ return pd.read_excel(excel_file.name)
 
34
  except Exception as e:
35
+ return pd.DataFrame({"์˜ค๋ฅ˜": [str(e)]})
36
 
37
 
38
+ # PDF โ†’ ๋ฒกํ„ฐDB
39
  def build_database(country_folder):
40
  if country_folder == "ํด๋” ์—†์Œ":
41
  return None
42
 
43
  all_texts = []
44
+ splitter = RecursiveCharacterTextSplitter(chunk_size=800, chunk_overlap=100)
 
 
 
45
 
46
  path = f"./{country_folder}"
47
+ files = [f for f in os.listdir(path) if f.lower().endswith(".pdf")]
 
 
 
48
 
49
  if not files:
50
  return None
 
55
  for page in pdf.pages:
56
  text = page.extract_text()
57
  if text:
58
+ all_texts.extend(splitter.split_text(f"[์ถœ์ฒ˜: {filename}] {text}"))
 
 
 
 
59
  except Exception as e:
60
+ print(f"PDF ์˜ค๋ฅ˜: {filename} / {e}")
 
61
 
62
  if not all_texts:
63
  return None
 
66
  return FAISS.from_texts(all_texts, embeddings)
67
 
68
 
69
+ # ์—‘์…€ ์Šคํƒ€์ผ
70
+ def style_excel(path):
71
+ wb = load_workbook(path)
72
  ws = wb.active
73
 
74
+ red = PatternFill(start_color="FFC7CE", end_color="FFC7CE", fill_type="solid")
75
+ yellow = PatternFill(start_color="FFF2CC", end_color="FFF2CC", fill_type="solid")
 
 
 
 
 
 
76
 
77
+ headers = [c.value for c in ws[1]]
78
  ์ ํ•ฉ_col = headers.index("์ ํ•ฉ ์—ฌ๋ถ€") + 1
79
  ๊ทœ์ œ_col = headers.index("๊ทœ์ œ ์ •๋„") + 1
80
 
81
  for row in range(2, ws.max_row + 1):
82
+ status = str(ws.cell(row, ์ ํ•ฉ_col).value or "")
83
+ reg = str(ws.cell(row, ๊ทœ์ œ_col).value or "")
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
+ if "๋ถ€์ ํ•ฉ" in status:
86
+ for c in range(1, ws.max_column + 1):
87
+ ws.cell(row, c).fill = red
 
 
 
 
88
 
89
+ elif "ํ™•์ธ ํ•„์š”" in status or ("์ •๋ณด ์—†์Œ" not in reg and reg.strip()):
90
+ for c in range(1, ws.max_column + 1):
91
+ ws.cell(row, c).fill = yellow
92
 
93
+ wb.save(path)
 
94
 
95
 
96
+ # ํ•ต์‹ฌ ๋ถ„์„
97
  def process_screening(country, excel_file):
98
  if not excel_file:
99
+ return None, "โŒ ์—‘์…€ ์—…๋กœ๋“œ ํ•„์š”"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
+ vector_db = build_database(country)
102
+ if not vector_db:
103
+ return None, "โŒ PDF ์—†์Œ"
104
 
105
+ llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
 
106
 
107
+ df = pd.read_excel(excel_file.name)
 
 
 
 
108
 
109
+ ์ ํ•ฉ์—ฌ๋ถ€, ๋ถ€์ ํ•ฉ์‚ฌ์œ , ๊ทœ์ œ๊ฒฐ๊ณผ = [], [], []
110
 
111
+ for _, row in df.iterrows():
112
+ ing = str(row.iloc[0]).strip()
 
113
 
114
+ if not ing:
115
+ ์ ํ•ฉ์—ฌ๋ถ€.append("ํ™•์ธ ํ•„์š”")
116
+ ๋ถ€์ ํ•ฉ์‚ฌ์œ .append("์„ฑ๋ถ„ ์—†์Œ")
117
+ ๊ทœ์ œ๊ฒฐ๊ณผ.append("์ •๋ณด ์—†์Œ")
118
+ continue
 
 
119
 
120
+ try:
121
+ docs = vector_db.similarity_search(ing, k=3)
122
+ context = "\n".join([d.page_content for d in docs])
123
 
124
+ prompt = f"""
125
+ ์„ฑ๋ถ„: {ing}
126
 
127
+ ๊ทœ์ œ ๊ธฐ๋ฐ˜์œผ๋กœ ์•„๋ž˜ ํ˜•์‹์œผ๋กœ ๋‹ต๋ณ€
128
 
129
  ์ ํ•ฉ ์—ฌ๋ถ€:
130
  ๋ถ€์ ํ•ฉ ์‚ฌ์œ :
131
  ๊ทœ์ œ ์ •๋„:
132
 
133
+ {context}
 
 
 
 
 
 
 
134
  """
135
 
136
+ res = llm.invoke(prompt).content
137
 
138
+ s, r, g = "", "", ""
 
 
139
 
140
+ for line in res.splitlines():
141
+ if line.startswith("์ ํ•ฉ ์—ฌ๋ถ€:"):
142
+ s = line.replace("์ ํ•ฉ ์—ฌ๋ถ€:", "").strip()
143
+ elif line.startswith("๋ถ€์ ํ•ฉ ์‚ฌ์œ :"):
144
+ r = line.replace("๋ถ€์ ํ•ฉ ์‚ฌ์œ :", "").strip()
145
+ elif line.startswith("๊ทœ์ œ ์ •๋„:"):
146
+ g = line.replace("๊ทœ์ œ ์ •๋„:", "").strip()
147
 
148
+ ์ ํ•ฉ์—ฌ๋ถ€.append(s or "ํ™•์ธ ํ•„์š”")
149
+ ๋ถ€์ ํ•ฉ์‚ฌ์œ .append(r or "-")
150
+ ๊ทœ์ œ๊ฒฐ๊ณผ.append(g or "์ •๋ณด ์—†์Œ")
151
 
152
+ except Exception as e:
153
+ ์ ํ•ฉ์—ฌ๋ถ€.append("ํ™•์ธ ํ•„์š”")
154
+ ๋ถ€์ ํ•ฉ์‚ฌ์œ .append(str(e))
155
+ ๊ทœ์ œ๊ฒฐ๊ณผ.append("์—๋Ÿฌ")
156
 
157
+ df["์ ํ•ฉ ์—ฌ๋ถ€"] = ์ ํ•ฉ์—ฌ๋ถ€
158
+ df["๋ถ€์ ํ•ฉ ์‚ฌ์œ "] = ๏ฟฝ๏ฟฝ๏ฟฝ์ ํ•ฉ์‚ฌ์œ 
159
+ df["๊ทœ์ œ ์ •๋„"] = ๊ทœ์ œ๊ฒฐ๊ณผ
160
 
161
+ out = f"result_{country}.xlsx"
162
+ df.to_excel(out, index=False)
163
+ style_excel(out)
164
 
165
+ return df, out
166
 
 
167
 
168
+ # UI
169
+ with gr.Blocks() as demo:
170
+ gr.Markdown("# ๐Ÿงช Regulatory AI")
171
+
172
+ country = gr.Dropdown(choices=get_country_folders(), value=get_country_folders()[0])
173
+ file = gr.File()
174
+
175
+ btn = gr.Button("๋ถ„์„")
176
+
177
+ df_out = gr.Dataframe(label="๋ฏธ๋ฆฌ๋ณด๊ธฐ", wrap=True, interactive=False)
178
+ file_out = gr.File()
179
+
180
+ file.change(preview_excel, inputs=file, outputs=df_out)
181
+ btn.click(process_screening, inputs=[country, file], outputs=[df_out, file_out])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
 
184
  demo.launch()