Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ def respond(
|
|
27 |
system_message,
|
28 |
):
|
29 |
try:
|
30 |
-
client = get_client(model_name)
|
31 |
except ValueError as e:
|
32 |
chat_history.append((message, str(e)))
|
33 |
return chat_history
|
@@ -50,7 +50,7 @@ def respond(
|
|
50 |
for response in stream:
|
51 |
if response.choices[0].delta.content is not None:
|
52 |
partial_message += response.choices[0].delta.content
|
53 |
-
chat_history = chat_history
|
54 |
yield chat_history
|
55 |
except Exception as e:
|
56 |
error_message = f"An error occurred: {str(e)}"
|
@@ -61,8 +61,8 @@ def clear_conversation():
|
|
61 |
return []
|
62 |
|
63 |
with gr.Blocks() as demo:
|
64 |
-
gr.Markdown("#
|
65 |
-
gr.Markdown("
|
66 |
|
67 |
with gr.Row():
|
68 |
with gr.Column(scale=1):
|
@@ -71,9 +71,9 @@ with gr.Blocks() as demo:
|
|
71 |
label="Language Model",
|
72 |
value="Zephyr 7B Beta"
|
73 |
)
|
74 |
-
max_tokens = gr.Slider(minimum=1, maximum=
|
75 |
-
temperature = gr.Slider(minimum=0.1, maximum=2.0, value=0.7, step=0.
|
76 |
-
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p
|
77 |
system_message = gr.Textbox(
|
78 |
value="You are a friendly and helpful AI assistant.",
|
79 |
label="System Message",
|
@@ -82,10 +82,10 @@ with gr.Blocks() as demo:
|
|
82 |
|
83 |
with gr.Column(scale=2):
|
84 |
chatbot = gr.Chatbot()
|
85 |
-
msg = gr.Textbox(label="
|
86 |
with gr.Row():
|
87 |
-
submit_button = gr.Button("
|
88 |
-
clear_button = gr.Button("
|
89 |
|
90 |
msg.submit(respond, [msg, chatbot, model_name, max_tokens, temperature, top_p, system_message], chatbot)
|
91 |
submit_button.click(respond, [msg, chatbot, model_name, max_tokens, temperature, top_p, system_message], chatbot)
|
|
|
27 |
system_message,
|
28 |
):
|
29 |
try:
|
30 |
+
client = get_client(model_name)
|
31 |
except ValueError as e:
|
32 |
chat_history.append((message, str(e)))
|
33 |
return chat_history
|
|
|
50 |
for response in stream:
|
51 |
if response.choices[0].delta.content is not None:
|
52 |
partial_message += response.choices[0].delta.content
|
53 |
+
chat_history = chat_history + [(message, partial_message)]
|
54 |
yield chat_history
|
55 |
except Exception as e:
|
56 |
error_message = f"An error occurred: {str(e)}"
|
|
|
61 |
return []
|
62 |
|
63 |
with gr.Blocks() as demo:
|
64 |
+
gr.Markdown("# Prompting AI Chatbot")
|
65 |
+
gr.Markdown("언어모델별 프롬프트 테스트 챗봇입니다.")
|
66 |
|
67 |
with gr.Row():
|
68 |
with gr.Column(scale=1):
|
|
|
71 |
label="Language Model",
|
72 |
value="Zephyr 7B Beta"
|
73 |
)
|
74 |
+
max_tokens = gr.Slider(minimum=1, maximum=2000, value=500, step=100, label="Max Tokens")
|
75 |
+
temperature = gr.Slider(minimum=0.1, maximum=2.0, value=0.7, step=0.05, label="Temperature")
|
76 |
+
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p")
|
77 |
system_message = gr.Textbox(
|
78 |
value="You are a friendly and helpful AI assistant.",
|
79 |
label="System Message",
|
|
|
82 |
|
83 |
with gr.Column(scale=2):
|
84 |
chatbot = gr.Chatbot()
|
85 |
+
msg = gr.Textbox(label="메세지를 입력하세요")
|
86 |
with gr.Row():
|
87 |
+
submit_button = gr.Button("전송")
|
88 |
+
clear_button = gr.Button("대화 내역 지우기")
|
89 |
|
90 |
msg.submit(respond, [msg, chatbot, model_name, max_tokens, temperature, top_p, system_message], chatbot)
|
91 |
submit_button.click(respond, [msg, chatbot, model_name, max_tokens, temperature, top_p, system_message], chatbot)
|