Update app.py
Browse files
app.py
CHANGED
|
@@ -170,22 +170,23 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
|
|
| 170 |
)
|
| 171 |
|
| 172 |
# Ô nhập prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
prompt_box = gr.Textbox(
|
| 174 |
label="Your Message",
|
| 175 |
placeholder="Nhập tin nhắn của bạn và nhấn Enter...",
|
| 176 |
lines=1
|
| 177 |
)
|
| 178 |
-
|
| 179 |
-
lang = gr.Textbox(
|
| 180 |
-
label="lang",
|
| 181 |
-
placeholder="...",
|
| 182 |
-
lines=1
|
| 183 |
-
)
|
| 184 |
|
| 185 |
with gr.Row():
|
| 186 |
clear_button = gr.Button("Clear Chat")
|
| 187 |
# Nút submit này ẩn đi, chúng ta dùng Enter từ prompt_box
|
| 188 |
-
submit_button = gr.Button("Send"
|
| 189 |
|
| 190 |
with gr.Column(scale=1):
|
| 191 |
# Ô System Prompt
|
|
@@ -200,15 +201,15 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
|
|
| 200 |
# Khi người dùng nhấn Enter trong `prompt_box`
|
| 201 |
prompt_box.submit(
|
| 202 |
fn=chat_with_model,
|
| 203 |
-
inputs=[prompt_box, system_prompt_box, chatbot_display, internal_history],
|
| 204 |
-
outputs=[prompt_box, chatbot_display, internal_history
|
| 205 |
)
|
| 206 |
|
| 207 |
# Khi người dùng nhấn nút "Send" (ẩn)
|
| 208 |
submit_button.click(
|
| 209 |
fn=chat_with_model,
|
| 210 |
-
inputs=[prompt_box, system_prompt_box, chatbot_display, internal_history],
|
| 211 |
-
outputs=[prompt_box, chatbot_display, internal_history
|
| 212 |
)
|
| 213 |
|
| 214 |
# Khi người dùng nhấn nút "Clear Chat"
|
|
|
|
| 170 |
)
|
| 171 |
|
| 172 |
# Ô nhập prompt
|
| 173 |
+
|
| 174 |
+
lang = gr.Textbox(
|
| 175 |
+
label="lang",
|
| 176 |
+
placeholder="Nhập tin nhắn của bạn....",
|
| 177 |
+
lines=1
|
| 178 |
+
)
|
| 179 |
+
|
| 180 |
prompt_box = gr.Textbox(
|
| 181 |
label="Your Message",
|
| 182 |
placeholder="Nhập tin nhắn của bạn và nhấn Enter...",
|
| 183 |
lines=1
|
| 184 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
|
| 186 |
with gr.Row():
|
| 187 |
clear_button = gr.Button("Clear Chat")
|
| 188 |
# Nút submit này ẩn đi, chúng ta dùng Enter từ prompt_box
|
| 189 |
+
submit_button = gr.Button("Send")
|
| 190 |
|
| 191 |
with gr.Column(scale=1):
|
| 192 |
# Ô System Prompt
|
|
|
|
| 201 |
# Khi người dùng nhấn Enter trong `prompt_box`
|
| 202 |
prompt_box.submit(
|
| 203 |
fn=chat_with_model,
|
| 204 |
+
inputs=[prompt_box, system_prompt_box, chatbot_display, internal_history,lang],
|
| 205 |
+
outputs=[prompt_box, chatbot_display, internal_history]
|
| 206 |
)
|
| 207 |
|
| 208 |
# Khi người dùng nhấn nút "Send" (ẩn)
|
| 209 |
submit_button.click(
|
| 210 |
fn=chat_with_model,
|
| 211 |
+
inputs=[prompt_box, system_prompt_box, chatbot_display, internal_history,lang],
|
| 212 |
+
outputs=[prompt_box, chatbot_display, internal_history]
|
| 213 |
)
|
| 214 |
|
| 215 |
# Khi người dùng nhấn nút "Clear Chat"
|