Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,85 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
with gr.
|
5 |
-
|
6 |
-
gr.Markdown(
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
demo
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
|
4 |
+
def create_deepseek_interface():
|
5 |
+
with gr.Blocks(theme="soft", fill_height=True) as demo:
|
6 |
+
# Header Section
|
7 |
+
gr.Markdown(
|
8 |
+
"""
|
9 |
+
# π€ DeepSeek V3 Inference Interface
|
10 |
+
### Advanced AI Model Powered by Fireworks AI
|
11 |
+
"""
|
12 |
+
)
|
13 |
+
|
14 |
+
# Sidebar with Model Information and Login
|
15 |
+
with gr.Sidebar(variant="compact"):
|
16 |
+
gr.Markdown(
|
17 |
+
"""
|
18 |
+
## π Access Control
|
19 |
+
### Inference Provider
|
20 |
+
This Space showcases the DeepSeek-V3-0324 model,
|
21 |
+
served by the Fireworks AI API.
|
22 |
+
|
23 |
+
#### Authentication
|
24 |
+
- Sign in with your Hugging Face account
|
25 |
+
- Secure API access
|
26 |
+
"""
|
27 |
+
)
|
28 |
+
|
29 |
+
# Styled Login Button
|
30 |
+
with gr.Row():
|
31 |
+
button = gr.LoginButton(
|
32 |
+
"Sign In",
|
33 |
+
variant="primary",
|
34 |
+
icon="π€"
|
35 |
+
)
|
36 |
+
|
37 |
+
# Model Details Section
|
38 |
+
gr.Markdown(
|
39 |
+
"""
|
40 |
+
### π Model Details
|
41 |
+
- **Model**: DeepSeek-V3-0324
|
42 |
+
- **Provider**: Fireworks AI
|
43 |
+
- **Capabilities**: Advanced Language Understanding
|
44 |
+
"""
|
45 |
+
)
|
46 |
+
|
47 |
+
# Main Content Area
|
48 |
+
with gr.Column(variant="panel"):
|
49 |
+
# Placeholder for model interaction
|
50 |
+
chatbot = gr.Chatbot(
|
51 |
+
height=500,
|
52 |
+
placeholder="Model is ready. Please authenticate to begin.",
|
53 |
+
label="DeepSeek V3 Chat"
|
54 |
+
)
|
55 |
+
|
56 |
+
with gr.Row():
|
57 |
+
msg = gr.Textbox(
|
58 |
+
label="Your Message",
|
59 |
+
placeholder="Type your prompt here...",
|
60 |
+
show_label=True
|
61 |
+
)
|
62 |
+
submit = gr.Button("Send", variant="primary")
|
63 |
+
|
64 |
+
# Button to clear chat history
|
65 |
+
clear = gr.ClearButton([msg, chatbot], value="π§Ή Clear Conversation")
|
66 |
+
|
67 |
+
# Load Model with Authentication
|
68 |
+
model = gr.load(
|
69 |
+
"models/deepseek-ai/DeepSeek-V3-0324",
|
70 |
+
accept_token=button,
|
71 |
+
provider="fireworks-ai"
|
72 |
+
)
|
73 |
+
|
74 |
+
# Simple interaction setup (placeholder)
|
75 |
+
submit.click(
|
76 |
+
lambda x: x,
|
77 |
+
inputs=msg,
|
78 |
+
outputs=chatbot
|
79 |
+
)
|
80 |
|
81 |
+
return demo
|
82 |
+
|
83 |
+
# Launch the interface
|
84 |
+
demo = create_deepseek_interface()
|
85 |
+
demo.launch(debug=True)
|