cnp-ai commited on
Commit
e401407
·
verified ·
1 Parent(s): 769e6ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -176,7 +176,19 @@ def search_kpi_one(kpi_query, kpi_count, mode):
176
  kpi_df = df[['지표명', '정의', '산식', '유형', '비고', 'BSC 관점', '전략방향', '전략과제']].copy()
177
 
178
  return visible_df, kpi_df, kpi_list
179
-
 
 
 
 
 
 
 
 
 
 
 
 
180
  def search_kpi_all_models(kpi_query, kpi_count):
181
  print("함수 호출, 테이블 생성 시작")
182
  # 각 모델별 결과
@@ -184,16 +196,9 @@ def search_kpi_all_models(kpi_query, kpi_count):
184
  visible_sn, kpi_sn, list_sn = search_kpi_one(kpi_query, kpi_count, "SBERT-snunlp")
185
  visible_jh, kpi_jh, list_jh = search_kpi_one(kpi_query, kpi_count, "SBERT-jhgan")
186
  print("함수 종료")
187
-
188
- def format_df_text(df):
189
- lines = []
190
- for _, row in df.iterrows():
191
- line = f"{row['지표명']} / {row['산식']}\n{row['비고']}\n"
192
- lines.append(line)
193
- return "\n".join(lines)
194
 
195
  visible_df = [visible_bge, visible_sn, visible_jh]
196
- visible_df_text = [df.to_string(index=False) for df in visible_df]
197
 
198
  return (
199
  gr.update(visible=True),
 
176
  kpi_df = df[['지표명', '정의', '산식', '유형', '비고', 'BSC 관점', '전략방향', '전략과제']].copy()
177
 
178
  return visible_df, kpi_df, kpi_list
179
+
180
+ def format_df_html(df):
181
+ html = ""
182
+ for i, row in df.iterrows():
183
+ html += f"""
184
+ <div style="margin-bottom: 5px;">
185
+ <span style="font-size: 18px; font-weight: bold;">[{i+1}] {row['지표명']}</span><br>
186
+ <span style="font-size: 13px; color: gray;">{row['비고']}</span><br>
187
+ <div style="margin-top: 5px; font-size: 14px; color: #333;">{row['산식']}</div>
188
+ </div>
189
+ """
190
+ return html
191
+
192
  def search_kpi_all_models(kpi_query, kpi_count):
193
  print("함수 호출, 테이블 생성 시작")
194
  # 각 모델별 결과
 
196
  visible_sn, kpi_sn, list_sn = search_kpi_one(kpi_query, kpi_count, "SBERT-snunlp")
197
  visible_jh, kpi_jh, list_jh = search_kpi_one(kpi_query, kpi_count, "SBERT-jhgan")
198
  print("함수 종료")
 
 
 
 
 
 
 
199
 
200
  visible_df = [visible_bge, visible_sn, visible_jh]
201
+ visible_df_text = [format_df_html(df) for df in visible_df]
202
 
203
  return (
204
  gr.update(visible=True),