Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -57,10 +57,16 @@ models = {
|
|
| 57 |
}
|
| 58 |
|
| 59 |
with gr.Blocks() as demo:
|
| 60 |
-
chatbot = gr.Chatbot(height=
|
| 61 |
|
| 62 |
with gr.Row():
|
| 63 |
-
msg = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
send = gr.Button("전송", scale=1)
|
| 65 |
|
| 66 |
with gr.Row():
|
|
@@ -74,13 +80,14 @@ with gr.Blocks() as demo:
|
|
| 74 |
label="시스템 메시지",
|
| 75 |
lines=10
|
| 76 |
)
|
| 77 |
-
max_tokens = gr.Slider(minimum=
|
| 78 |
-
temperature = gr.Slider(minimum=0, maximum=
|
| 79 |
-
top_p = gr.Slider(minimum=0, maximum=1.0, value=0.90, step=0.05, label="Top-p (핵 샘플링)")
|
| 80 |
model = gr.Radio(list(models.keys()), value=list(models.keys())[0], label="언어 모델 선택", info="사용할 언어 모델을 선택하세요")
|
| 81 |
|
| 82 |
-
|
| 83 |
msg.submit(respond, inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, model], outputs=[msg, chatbot])
|
|
|
|
| 84 |
regenerate.click(lambda h, s, m, t, p, mod: respond(h[-1][0] if h else "", h[:-1], s, m, t, p, mod), inputs=[chatbot, system_message, max_tokens, temperature, top_p, model], outputs=[msg, chatbot])
|
| 85 |
stop.click(stop_generation, inputs=[], outputs=[msg])
|
| 86 |
clear.click(lambda: (None, None), outputs=[msg, chatbot])
|
|
|
|
| 57 |
}
|
| 58 |
|
| 59 |
with gr.Blocks() as demo:
|
| 60 |
+
chatbot = gr.Chatbot(height=600)
|
| 61 |
|
| 62 |
with gr.Row():
|
| 63 |
+
msg = gr.Textbox(
|
| 64 |
+
scale=4,
|
| 65 |
+
label="메시지 입력",
|
| 66 |
+
lines=3,
|
| 67 |
+
placeholder="메시지를 입력하세요. 엔터 키로 전송, Shift+Enter로 줄바꿈",
|
| 68 |
+
submit_on_enter=True # 엔터 키로 제출 활성화
|
| 69 |
+
)
|
| 70 |
send = gr.Button("전송", scale=1)
|
| 71 |
|
| 72 |
with gr.Row():
|
|
|
|
| 80 |
label="시스템 메시지",
|
| 81 |
lines=10
|
| 82 |
)
|
| 83 |
+
max_tokens = gr.Slider(minimum=1, maximum=2000, value=500, step=100, label="최대 새 토큰 수")
|
| 84 |
+
temperature = gr.Slider(minimum=0.1, maximum=2.0, value=0.7, step=0.05, label="온도")
|
| 85 |
+
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.90, step=0.05, label="Top-p (핵 샘플링)")
|
| 86 |
model = gr.Radio(list(models.keys()), value=list(models.keys())[0], label="언어 모델 선택", info="사용할 언어 모델을 선택하세요")
|
| 87 |
|
| 88 |
+
# 이벤트 핸들러 설정
|
| 89 |
msg.submit(respond, inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, model], outputs=[msg, chatbot])
|
| 90 |
+
send.click(respond, inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, model], outputs=[msg, chatbot])
|
| 91 |
regenerate.click(lambda h, s, m, t, p, mod: respond(h[-1][0] if h else "", h[:-1], s, m, t, p, mod), inputs=[chatbot, system_message, max_tokens, temperature, top_p, model], outputs=[msg, chatbot])
|
| 92 |
stop.click(stop_generation, inputs=[], outputs=[msg])
|
| 93 |
clear.click(lambda: (None, None), outputs=[msg, chatbot])
|