Alhdrawi commited on
Commit
d9eab81
·
verified ·
1 Parent(s): 445514f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -34
app.py CHANGED
@@ -1,39 +1,9 @@
1
  import gradio as gr
2
 
3
- # تحميل النموذج من Hugging Face مع المزود sambanova
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
- chat_interface = gr.ChatInterface(
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()