Update app.py
Browse files
app.py
CHANGED
@@ -75,6 +75,13 @@ def search_unit(unit_query, mode):
|
|
75 |
"""
|
76 |
return text
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
downsample_model_ori = SentenceTransformer('BAAI/bge-m3')
|
79 |
downsample_model = SentenceTransformer('snunlp/KR-SBERT-V40K-klueNLI-augSTS')
|
80 |
downsample_model_2 = SentenceTransformer('jhgan/ko-sbert-sts')
|
@@ -326,7 +333,7 @@ with gr.Blocks(css=css) as demo:
|
|
326 |
- SBERT-snunlp : 의미 중심 검색.
|
327 |
- SBERT-jhgan : 유사도 중심 검색.
|
328 |
""")
|
329 |
-
mode = gr.Dropdown(choices={"BGE","SBERT-snunlp","SBERT-jhgan"}, label="모델을 선택하세요")
|
330 |
gr.Markdown(" ")
|
331 |
with gr.Tab("KPI Pool 검색"):
|
332 |
with gr.Column(elem_classes="left-padding"):
|
@@ -342,7 +349,7 @@ with gr.Blocks(css=css) as demo:
|
|
342 |
with gr.Column(visible=False) as output_area:
|
343 |
with gr.Group():
|
344 |
with gr.Row():
|
345 |
-
kpi_checkbox = gr.CheckboxGroup(choices=[], interactive=True, elem_classes="v_check", container=False, min_width=5, scale=1)
|
346 |
|
347 |
with gr.Group():
|
348 |
gr.Markdown("BGE")
|
@@ -377,17 +384,17 @@ with gr.Blocks(css=css) as demo:
|
|
377 |
|
378 |
#kpi_query.submit(search_kpi, inputs = [kpi_query, kpi_count, mode], outputs = [output_area, kpi_checkbox, kpi_table, df_state, check_state, copyright])
|
379 |
kpi_query.submit(search_kpi_all_models, inputs = [kpi_query, kpi_count], outputs = [output_area, kpi_table1, kpi_table2, kpi_table3, copyright])
|
380 |
-
select_button.click(fn=toggle_selection, inputs=[kpi_checkbox, check_state], outputs=kpi_checkbox, show_progress='hidden')
|
381 |
#download_button.click(
|
382 |
# generate_excel,
|
383 |
# inputs=[df_state, kpi_checkbox, kpi_query],
|
384 |
# outputs=[file_download]
|
385 |
#)
|
386 |
clear_button.click(
|
387 |
-
fn=lambda: (None, None,
|
388 |
gr.update(choices=[], value=[]), gr.update(value=[]),gr.update(value=[]),gr.update(value=[]),
|
389 |
gr.update(value=None, visible=False), gr.update(visible=True)),
|
390 |
-
outputs=[df_state,
|
391 |
kpi_checkbox, kpi_table1, kpi_table2, kpi_table3,
|
392 |
file_download, copyright],
|
393 |
show_progress='hidden'
|
@@ -397,8 +404,19 @@ with gr.Blocks(css=css) as demo:
|
|
397 |
with gr.Tab("[참고] NCS 능력단위"):
|
398 |
unit_query = gr.Textbox(label="업종 or 직종 + 직무명을 입력하세요😊", scale=1, submit_btn=True,
|
399 |
placeholder="예: 의약품 법률자문, 공공행정 경영기획, 재무회계 자금")
|
400 |
-
|
401 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
|
403 |
|
404 |
demo.launch(debug=True)
|
|
|
75 |
"""
|
76 |
return text
|
77 |
|
78 |
+
def search_unit_all(unit_query):
|
79 |
+
text_bge = search_unit(unit_query, "BGE")
|
80 |
+
text_snu = search_unit(unit_query, "SBERT-snunlp")
|
81 |
+
text_jh = search_unit(unit_query, "SBERT-jhgan")
|
82 |
+
|
83 |
+
return text_bge, text_snu, text_jh
|
84 |
+
|
85 |
downsample_model_ori = SentenceTransformer('BAAI/bge-m3')
|
86 |
downsample_model = SentenceTransformer('snunlp/KR-SBERT-V40K-klueNLI-augSTS')
|
87 |
downsample_model_2 = SentenceTransformer('jhgan/ko-sbert-sts')
|
|
|
333 |
- SBERT-snunlp : 의미 중심 검색.
|
334 |
- SBERT-jhgan : 유사도 중심 검색.
|
335 |
""")
|
336 |
+
#mode = gr.Dropdown(choices={"BGE","SBERT-snunlp","SBERT-jhgan"}, label="모델을 선택하세요")
|
337 |
gr.Markdown(" ")
|
338 |
with gr.Tab("KPI Pool 검색"):
|
339 |
with gr.Column(elem_classes="left-padding"):
|
|
|
349 |
with gr.Column(visible=False) as output_area:
|
350 |
with gr.Group():
|
351 |
with gr.Row():
|
352 |
+
#kpi_checkbox = gr.CheckboxGroup(choices=[], interactive=True, elem_classes="v_check", container=False, min_width=5, scale=1)
|
353 |
|
354 |
with gr.Group():
|
355 |
gr.Markdown("BGE")
|
|
|
384 |
|
385 |
#kpi_query.submit(search_kpi, inputs = [kpi_query, kpi_count, mode], outputs = [output_area, kpi_checkbox, kpi_table, df_state, check_state, copyright])
|
386 |
kpi_query.submit(search_kpi_all_models, inputs = [kpi_query, kpi_count], outputs = [output_area, kpi_table1, kpi_table2, kpi_table3, copyright])
|
387 |
+
#select_button.click(fn=toggle_selection, inputs=[kpi_checkbox, check_state], outputs=kpi_checkbox, show_progress='hidden')
|
388 |
#download_button.click(
|
389 |
# generate_excel,
|
390 |
# inputs=[df_state, kpi_checkbox, kpi_query],
|
391 |
# outputs=[file_download]
|
392 |
#)
|
393 |
clear_button.click(
|
394 |
+
fn=lambda: (None, None, gr.update(visible=False),
|
395 |
gr.update(choices=[], value=[]), gr.update(value=[]),gr.update(value=[]),gr.update(value=[]),
|
396 |
gr.update(value=None, visible=False), gr.update(visible=True)),
|
397 |
+
outputs=[df_state, kpi_query, output_area,
|
398 |
kpi_checkbox, kpi_table1, kpi_table2, kpi_table3,
|
399 |
file_download, copyright],
|
400 |
show_progress='hidden'
|
|
|
404 |
with gr.Tab("[참고] NCS 능력단위"):
|
405 |
unit_query = gr.Textbox(label="업종 or 직종 + 직무명을 입력하세요😊", scale=1, submit_btn=True,
|
406 |
placeholder="예: 의약품 법률자문, 공공행정 경영기획, 재무회계 자금")
|
407 |
+
with gr.Row():
|
408 |
+
with gr.Group():
|
409 |
+
gr.Markdown("BGE")
|
410 |
+
unit_result1 = gr.Markdown()
|
411 |
+
with gr.Group():
|
412 |
+
gr.Markdown("SBERT-snunlp")
|
413 |
+
unit_result2 = gr.Markdown()
|
414 |
+
with gr.Group():
|
415 |
+
gr.Markdown("SBERT-jhgan")
|
416 |
+
unit_result3 = gr.Markdown()
|
417 |
+
|
418 |
+
#unit_query.submit(search_unit, inputs=[unit_query, mode], outputs=[unit_result])
|
419 |
+
unit_query.submit(search_unit_all, inputs=unit_query, outputs=[unit_result1, unit_result2, unit_result3])
|
420 |
|
421 |
|
422 |
demo.launch(debug=True)
|