Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,39 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
chatbot = gr.load(
|
5 |
-
"models/deepseek-ai/DeepSeek-R1",
|
6 |
-
provider="sambanova",
|
7 |
-
)
|
8 |
|
9 |
-
|
10 |
-
def chat_fn(message, history):
|
11 |
-
return chatbot(message)
|
12 |
-
|
13 |
-
# واجهة API بسيطة تستقبل نص وتعيد الرد
|
14 |
-
def api_fn(input_text):
|
15 |
return chatbot(input_text)
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
fn=chat_fn,
|
20 |
-
title="RAY AI Chat with DeepSeek",
|
21 |
-
description="نموذج DeepSeek R1 عبر مزود Sambanova - مخصص لتطبيقات الأشعة والذكاء الطبي.",
|
22 |
-
)
|
23 |
-
|
24 |
-
# واجهة API
|
25 |
-
api_interface = gr.Interface(
|
26 |
-
fn=api_fn,
|
27 |
-
inputs=gr.Textbox(label="User Message"),
|
28 |
-
outputs=gr.Textbox(label="Model Reply"),
|
29 |
-
title="DeepSeek API Access",
|
30 |
-
description="API endpoint to interact with DeepSeek-R1",
|
31 |
-
)
|
32 |
-
|
33 |
-
# إطلاق الواجهتين معًا
|
34 |
-
demo = gr.TabbedInterface(
|
35 |
-
interface_list=[chat_interface, api_interface],
|
36 |
-
tab_names=["💬 دردشة", "🔗 API"]
|
37 |
-
)
|
38 |
-
|
39 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
chatbot = gr.load("models/deepseek-ai/DeepSeek-R1", provider="sambanova")
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
def predict(input_text):
|
|
|
|
|
|
|
|
|
|
|
6 |
return chatbot(input_text)
|
7 |
|
8 |
+
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
9 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|