Spaces:
Paused
Paused
ElPlaguister
commited on
Commit
·
10c5e96
1
Parent(s):
926b662
Feat App.py Change Label
Browse files- __pycache__/t5.cpython-39.pyc +0 -0
- app.py +4 -3
__pycache__/t5.cpython-39.pyc
DELETED
Binary file (1.61 kB)
|
|
app.py
CHANGED
@@ -4,6 +4,7 @@ from t5 import T5
|
|
4 |
from koalpaca import KoAlpaca
|
5 |
|
6 |
LOCAL_TEST = False
|
|
|
7 |
MODELS = []
|
8 |
cur_index = 0
|
9 |
|
@@ -44,7 +45,7 @@ def prepare_theme():
|
|
44 |
def chat(message, chat_history):
|
45 |
response = MODELS[cur_index].generate(message)
|
46 |
chat_history.append((message, response))
|
47 |
-
return "", chat_history
|
48 |
|
49 |
def change_model_index(idx):
|
50 |
global cur_index
|
@@ -61,11 +62,11 @@ if __name__=='__main__':
|
|
61 |
|
62 |
with gr.Blocks(theme=theme) as demo:
|
63 |
with gr.Row():
|
64 |
-
rd = gr.Radio(
|
65 |
with gr.Column(scale=5): # 챗봇 부분
|
66 |
chatbot = gr.Chatbot(label="T5", bubble_full_width=False)
|
67 |
with gr.Row():
|
68 |
-
txt = gr.Textbox(show_label=False, placeholder='
|
69 |
|
70 |
txt.submit(chat, [txt, chatbot], [txt, chatbot])
|
71 |
rd.select(change_model_index, [rd])
|
|
|
4 |
from koalpaca import KoAlpaca
|
5 |
|
6 |
LOCAL_TEST = False
|
7 |
+
MODEL_STRS = ['T5', 'KoAlpaca']
|
8 |
MODELS = []
|
9 |
cur_index = 0
|
10 |
|
|
|
45 |
def chat(message, chat_history):
|
46 |
response = MODELS[cur_index].generate(message)
|
47 |
chat_history.append((message, response))
|
48 |
+
return "", gr.Chatbot(chat_history, label=MODEL_STRS[cur_index], bubble_full_width=False)
|
49 |
|
50 |
def change_model_index(idx):
|
51 |
global cur_index
|
|
|
62 |
|
63 |
with gr.Blocks(theme=theme) as demo:
|
64 |
with gr.Row():
|
65 |
+
rd = gr.Radio(MODEL_STRS, value='T5', type='index', label='Model Selection', show_label=True, interactive=True)
|
66 |
with gr.Column(scale=5): # 챗봇 부분
|
67 |
chatbot = gr.Chatbot(label="T5", bubble_full_width=False)
|
68 |
with gr.Row():
|
69 |
+
txt = gr.Textbox(show_label=False, placeholder='연애 관련 질문을 입력하세요!', container=False)
|
70 |
|
71 |
txt.submit(chat, [txt, chatbot], [txt, chatbot])
|
72 |
rd.select(change_model_index, [rd])
|