Spaces:
Running
Running
Commit
·
34ef4bd
1
Parent(s):
0619df4
test deepseek
Browse files
app.py
CHANGED
@@ -1,29 +1,23 @@
|
|
1 |
import gradio as gr
|
2 |
import call_api
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
):
|
22 |
-
raw = call_api.call_deepseek(
|
23 |
-
message, history, system_message, max_tokens, temperature, top_p,
|
24 |
-
file_upload=file_upload, image_upload=image_upload
|
25 |
-
)
|
26 |
-
return format_reply(raw)
|
27 |
|
28 |
with gr.Blocks() as demo: # Bắt đầu Blocks
|
29 |
# Thành phần hiển thị lịch sử chat
|
@@ -58,4 +52,4 @@ with gr.Blocks() as demo: # Bắt đầu Blocks
|
|
58 |
|
59 |
# Chạy app
|
60 |
if __name__ == "__main__":
|
61 |
-
|
|
|
1 |
import gradio as gr
|
2 |
import call_api
|
3 |
|
4 |
+
chat = gr.ChatInterface(
|
5 |
+
call_api.respond, #chat
|
6 |
+
title="Trợ lý Học Tập AI",
|
7 |
+
description="Nhập câu hỏi của bạn về Toán, Lý, Hóa, Văn… và nhận giải đáp chi tiết ngay lập tức!",
|
8 |
+
additional_inputs=[
|
9 |
+
gr.Textbox("Bạn là một chatbot tiếng Việt thân thiện.", label="System message"),
|
10 |
+
gr.Slider(1, 2048, value=200, step=1, label="Max new tokens"),
|
11 |
+
gr.Slider(0.1, 4.0, value=0.7, step=0.1, label="Temperature"),
|
12 |
+
gr.Slider(0.1, 1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
13 |
+
gr.Image(type="pil", label="Attach an image (optional)"),
|
14 |
+
gr.File(label="Upload a file (optional)"),
|
15 |
+
],
|
16 |
+
# examples=[
|
17 |
+
# # Mỗi item: [message, system_message, max_tokens, temperature, top_p]
|
18 |
+
# ["tích phân của x^2 từ 0 đến 2 là gì? vui lòng lập luận từng bước, và đặt kết quả cuối cùng trong \boxed{}", "bạn là nhà toán học", 100, 0.7, 0.95],
|
19 |
+
# ],
|
20 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
with gr.Blocks() as demo: # Bắt đầu Blocks
|
23 |
# Thành phần hiển thị lịch sử chat
|
|
|
52 |
|
53 |
# Chạy app
|
54 |
if __name__ == "__main__":
|
55 |
+
chat.launch()
|