Spaces:
Running on Zero
Running on Zero
zhang commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,25 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import spaces
|
| 3 |
|
|
|
|
| 4 |
@spaces.GPU
|
| 5 |
-
def
|
| 6 |
-
#
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
# 构建界面
|
| 10 |
with gr.Blocks(fill_height=True) as demo:
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
gr.Markdown("### 专利级满血算力演示站")
|
| 14 |
-
gr.Markdown("本节点由 OpenIPOS 运营,提供满血推理能力。")
|
| 15 |
-
gr.LoginButton("Sign in")
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
# 去掉了末尾可能引起误会的逗号
|
| 21 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import spaces
|
| 3 |
|
| 4 |
+
# 定义推理逻辑
|
| 5 |
@spaces.GPU
|
| 6 |
+
def chat_fn(message, history):
|
| 7 |
+
# 调用 DeepSeek-R1 32B 接口
|
| 8 |
+
# 这是一种更稳定的 API 调用流式写法
|
| 9 |
+
model = gr.load("models/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B")
|
| 10 |
+
response = model(message)
|
| 11 |
+
return response
|
| 12 |
|
| 13 |
+
# 构建 OpenIPOS 品牌界面
|
| 14 |
with gr.Blocks(fill_height=True) as demo:
|
| 15 |
+
gr.Markdown("# 🚀 OpenIPOS Global 算力节点")
|
| 16 |
+
gr.Markdown("### DeepSeek-R1 32B 满血版演示站")
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
# 核心聊天组件
|
| 19 |
+
gr.ChatInterface(
|
| 20 |
+
chat_fn,
|
| 21 |
+
type="messages",
|
| 22 |
+
description="本节点由 OpenIPOS 提供法律级高逻辑推理算力支持。",
|
| 23 |
+
)
|
| 24 |
|
|
|
|
| 25 |
demo.launch()
|