Update app.py
Browse files
app.py
CHANGED
|
@@ -1,32 +1,40 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import pandas as pd
|
| 3 |
-
from sentence_transformers import SentenceTransformer
|
| 4 |
-
from sklearn.metrics.pairwise import cosine_similarity
|
| 5 |
|
| 6 |
-
title = "๐๊ณ ๋ฏผ ํด๊ฒฐ ๋์ ์ถ์ฒ ์ฑ๋ด๐"
|
| 7 |
-
description = "๊ณ ๋ฏผ์ด ๋ฌด์์ธ๊ฐ์? ๊ณ ๋ฏผ ํด๊ฒฐ์ ๋์์ค ์ฑ
์ ์ถ์ฒํด๋๋ฆฝ๋๋ค"
|
| 8 |
-
examples = [["์์ฆ ์ ์ด ์ ์จ๋ค"]]
|
| 9 |
|
| 10 |
|
| 11 |
-
model = SentenceTransformer('jhgan/ko-sroberta-multitask')
|
| 12 |
|
| 13 |
-
def response(message):
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
answer = df.loc[df['distance'].idxmax()]
|
| 17 |
-
Book_title = answer['์ ๋ชฉ']
|
| 18 |
-
Book_author = answer['์๊ฐ']
|
| 19 |
-
Book_publisher = answer['์ถํ์ฌ']
|
| 20 |
-
Book_comment = answer['์ํ']
|
| 21 |
-
return print(message)
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
gr.Interface(
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
).launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
# import pandas as pd
|
| 3 |
+
# from sentence_transformers import SentenceTransformer
|
| 4 |
+
# from sklearn.metrics.pairwise import cosine_similarity
|
| 5 |
|
| 6 |
+
# title = "๐๊ณ ๋ฏผ ํด๊ฒฐ ๋์ ์ถ์ฒ ์ฑ๋ด๐"
|
| 7 |
+
# description = "๊ณ ๋ฏผ์ด ๋ฌด์์ธ๊ฐ์? ๊ณ ๋ฏผ ํด๊ฒฐ์ ๋์์ค ์ฑ
์ ์ถ์ฒํด๋๋ฆฝ๋๋ค"
|
| 8 |
+
# examples = [["์์ฆ ์ ์ด ์ ์จ๋ค"]]
|
| 9 |
|
| 10 |
|
| 11 |
+
# model = SentenceTransformer('jhgan/ko-sroberta-multitask')
|
| 12 |
|
| 13 |
+
def response(message, history, additional_input_info):
|
| 14 |
+
# additional_input_info์ ํ
์คํธ๋ฅผ ์ฑ๋ด์ ๋๋ต ๋ค์ ์ถ๊ฐํฉ๋๋ค.
|
| 15 |
+
return "์ฑ๋ด์ ๋ฏธ์์ฑํ์์ต๋๋ค " + additional_input_info
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
gr.ChatInterface(
|
| 18 |
+
fn=response,
|
| 19 |
+
textbox=gr.Textbox(placeholder="๋ง๊ฑธ์ด์ฃผ์ธ์..", container=False, scale=7),
|
| 20 |
+
title="์ด๋ค ์ฑ๋ด์ ์ํ์ฌ๋ฏธ๊น?",
|
| 21 |
+
description="๋ฌผ์ด๋ณด๋ฉด ๋ตํ๋ ์ฑ๋ด์๋ฏธ๋ค.",
|
| 22 |
+
theme="soft",
|
| 23 |
+
examples=[["์๋ฝ"], ["์์ฆ ๋ฅ๋ค ใ
ใ
"], ["์ ์ฌ๋ฉ๋ด ์ถ์ฒ๋ฐ๋, ์ง์ฅ ์งฌ๋ฝ ํ 1"]],
|
| 24 |
+
retry_btn="๋ค์๋ณด๋ด๊ธฐ โฉ",
|
| 25 |
+
undo_btn="์ด์ ์ฑ ์ญ์ โ",
|
| 26 |
+
clear_btn="์ ์ฑ ์ญ์ ๐ซ",
|
| 27 |
+
additional_inputs=[
|
| 28 |
+
gr.Textbox("!!!", label="๋๋ง์๊ธฐ")
|
| 29 |
+
]
|
| 30 |
+
).launch()
|
| 31 |
|
| 32 |
+
# gr.Interface(
|
| 33 |
+
# fn=response,
|
| 34 |
+
# title=title,
|
| 35 |
+
# description=description,
|
| 36 |
+
# examples=examples,
|
| 37 |
+
# inputs=["text", "state"],
|
| 38 |
+
# outputs=["chatbot", "state"],
|
| 39 |
+
# theme="finlaymacklon/boxy_violet",
|
| 40 |
+
# ).launch()
|