Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -10,20 +10,18 @@ deepseek_r1_distill = load_model("DeepSeek-R1-Distill-Qwen-32B")
|
|
10 |
deepseek_r1 = load_model("DeepSeek-R1")
|
11 |
deepseek_r1_zero = load_model("DeepSeek-R1-Zero")
|
12 |
|
13 |
-
# Disable API names for all functions (Gradio doesn't natively use `fns`)
|
14 |
-
# Adjust this section if specific API name disabling logic is required.
|
15 |
-
|
16 |
# Define the optional parameters section
|
17 |
def create_optional_parameters():
|
18 |
with gr.Accordion("Optional Parameters (Click to Expand)", open=False):
|
19 |
system_message = gr.Textbox(
|
20 |
label="System Message",
|
21 |
value="You are a friendly Chatbot created by ruslanmv.com",
|
22 |
-
lines=2
|
|
|
23 |
)
|
24 |
-
max_new_tokens = gr.Slider(minimum=1, maximum=4000, value=200, label="Max New Tokens")
|
25 |
-
temperature = gr.Slider(minimum=0.10, maximum=4.00, value=0.70, label="Temperature")
|
26 |
-
top_p = gr.Slider(minimum=0.10, maximum=1.00, value=0.90, label="Top-p (nucleus sampling)")
|
27 |
return system_message, max_new_tokens, temperature, top_p
|
28 |
|
29 |
# Define the main interface
|
@@ -40,14 +38,45 @@ def chat_interface(user_input, system_message, max_new_tokens, temperature, top_
|
|
40 |
return response
|
41 |
|
42 |
# Create the Gradio interface
|
43 |
-
with gr.Blocks(
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
with gr.Row():
|
47 |
-
with gr.Column():
|
48 |
-
user_input = gr.Textbox(
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
51 |
output = gr.Markdown(label="Chatbot Response")
|
52 |
|
53 |
# Add the optional parameters section
|
@@ -62,4 +91,4 @@ with gr.Blocks() as demo:
|
|
62 |
|
63 |
# Launch the demo
|
64 |
if __name__ == "__main__":
|
65 |
-
demo.launch()
|
|
|
10 |
deepseek_r1 = load_model("DeepSeek-R1")
|
11 |
deepseek_r1_zero = load_model("DeepSeek-R1-Zero")
|
12 |
|
|
|
|
|
|
|
13 |
# Define the optional parameters section
|
14 |
def create_optional_parameters():
|
15 |
with gr.Accordion("Optional Parameters (Click to Expand)", open=False):
|
16 |
system_message = gr.Textbox(
|
17 |
label="System Message",
|
18 |
value="You are a friendly Chatbot created by ruslanmv.com",
|
19 |
+
lines=2,
|
20 |
+
interactive=True
|
21 |
)
|
22 |
+
max_new_tokens = gr.Slider(minimum=1, maximum=4000, value=200, label="Max New Tokens", interactive=True)
|
23 |
+
temperature = gr.Slider(minimum=0.10, maximum=4.00, value=0.70, label="Temperature", interactive=True)
|
24 |
+
top_p = gr.Slider(minimum=0.10, maximum=1.00, value=0.90, label="Top-p (nucleus sampling)", interactive=True)
|
25 |
return system_message, max_new_tokens, temperature, top_p
|
26 |
|
27 |
# Define the main interface
|
|
|
38 |
return response
|
39 |
|
40 |
# Create the Gradio interface
|
41 |
+
with gr.Blocks(css="""
|
42 |
+
.gradio-container {
|
43 |
+
font-family: Arial, sans-serif;
|
44 |
+
background-color: #f9f9f9;
|
45 |
+
color: #333;
|
46 |
+
padding: 20px;
|
47 |
+
}
|
48 |
+
.gr-button.primary {
|
49 |
+
background-color: #4caf50;
|
50 |
+
color: white;
|
51 |
+
border: none;
|
52 |
+
padding: 10px 20px;
|
53 |
+
font-size: 16px;
|
54 |
+
border-radius: 5px;
|
55 |
+
cursor: pointer;
|
56 |
+
}
|
57 |
+
.gr-button.primary:hover {
|
58 |
+
background-color: #45a049;
|
59 |
+
}
|
60 |
+
.gr-textbox textarea {
|
61 |
+
font-size: 16px;
|
62 |
+
}
|
63 |
+
""") as demo:
|
64 |
+
gr.Markdown("""
|
65 |
+
# DeepSeek Chatbot
|
66 |
+
Welcome to the **DeepSeek Chatbot**! This AI-powered chatbot is designed to provide insightful responses.
|
67 |
+
Created by [ruslanmv.com](https://ruslanmv.com/).
|
68 |
+
""")
|
69 |
|
70 |
with gr.Row():
|
71 |
+
with gr.Column(scale=3):
|
72 |
+
user_input = gr.Textbox(
|
73 |
+
label="Your Message",
|
74 |
+
placeholder="Type your message here...",
|
75 |
+
lines=4,
|
76 |
+
interactive=True
|
77 |
+
)
|
78 |
+
submit_button = gr.Button("Send", variant="primary")
|
79 |
+
with gr.Column(scale=5):
|
80 |
output = gr.Markdown(label="Chatbot Response")
|
81 |
|
82 |
# Add the optional parameters section
|
|
|
91 |
|
92 |
# Launch the demo
|
93 |
if __name__ == "__main__":
|
94 |
+
demo.launch()
|