import gradio as gr | |
# import pandas as pd | |
# from sentence_transformers import SentenceTransformer | |
# from sklearn.metrics.pairwise import cosine_similarity | |
# title = "๐๊ณ ๋ฏผ ํด๊ฒฐ ๋์ ์ถ์ฒ ์ฑ๋ด๐" | |
# description = "๊ณ ๋ฏผ์ด ๋ฌด์์ธ๊ฐ์? ๊ณ ๋ฏผ ํด๊ฒฐ์ ๋์์ค ์ฑ ์ ์ถ์ฒํด๋๋ฆฝ๋๋ค" | |
# examples = [["์์ฆ ์ ์ด ์ ์จ๋ค"]] | |
# model = SentenceTransformer('jhgan/ko-sroberta-multitask') | |
def response(message, history, additional_input_info): | |
# additional_input_info์ ํ ์คํธ๋ฅผ ์ฑ๋ด์ ๋๋ต ๋ค์ ์ถ๊ฐํฉ๋๋ค. | |
return "์ฑ๋ด์ ๋ฏธ์์ฑํ์์ต๋๋ค " + additional_input_info | |
gr.ChatInterface( | |
fn=response, | |
textbox=gr.Textbox(placeholder="๋ง๊ฑธ์ด์ฃผ์ธ์..", container=False, scale=7), | |
title="์ด๋ค ์ฑ๋ด์ ์ํ์ฌ๋ฏธ๊น?", | |
description="๋ฌผ์ด๋ณด๋ฉด ๋ตํ๋ ์ฑ๋ด์๋ฏธ๋ค.", | |
theme="soft", | |
examples=[["์๋ฝ"], ["์์ฆ ๋ฅ๋ค ใ ใ "], ["์ ์ฌ๋ฉ๋ด ์ถ์ฒ๋ฐ๋, ์ง์ฅ ์งฌ๋ฝ ํ 1"]], | |
retry_btn="๋ค์๋ณด๋ด๊ธฐ โฉ", | |
undo_btn="์ด์ ์ฑ ์ญ์ โ", | |
clear_btn="์ ์ฑ ์ญ์ ๐ซ", | |
additional_inputs=[ | |
gr.Textbox("!!!", label="๋๋ง์๊ธฐ") | |
] | |
).launch() | |
# gr.Interface( | |
# fn=response, | |
# title=title, | |
# description=description, | |
# examples=examples, | |
# inputs=["text", "state"], | |
# outputs=["chatbot", "state"], | |
# theme="finlaymacklon/boxy_violet", | |
# ).launch() |