Spaces:
Running
Running
zRzRzRzRzRzRzR
commited on
Commit
Β·
cfdacf5
1
Parent(s):
26295fb
final 1
Browse files- README.md +1 -1
- app.py +7 -9
- requirements.txt +1 -1
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title: GLM 4.5
|
3 |
emoji: π
|
4 |
colorFrom: pink
|
5 |
colorTo: red
|
|
|
1 |
---
|
2 |
+
title: GLM 4.5 Demo (API)
|
3 |
emoji: π
|
4 |
colorFrom: pink
|
5 |
colorTo: red
|
app.py
CHANGED
@@ -13,7 +13,7 @@ def stream_from_vllm(messages, thinking_enabled=True, temperature=1.0):
|
|
13 |
client = OpenAI()
|
14 |
|
15 |
response = client.chat.completions.create(
|
16 |
-
model="
|
17 |
messages=messages,
|
18 |
temperature=temperature,
|
19 |
stream=True,
|
@@ -25,8 +25,6 @@ def stream_from_vllm(messages, thinking_enabled=True, temperature=1.0):
|
|
25 |
}
|
26 |
}
|
27 |
)
|
28 |
-
|
29 |
-
print(response)
|
30 |
for chunk in response:
|
31 |
if stop_generation:
|
32 |
break
|
@@ -148,17 +146,17 @@ def reset():
|
|
148 |
return [], [], ""
|
149 |
|
150 |
|
151 |
-
demo = gr.Blocks(title="GLM-4.5 API
|
152 |
|
153 |
with demo:
|
154 |
gr.HTML(
|
155 |
-
"<div style='text-align:center;font-size:32px;font-weight:bold;margin-bottom:10px;'>GLM-4.5 API
|
156 |
"<div style='text-align:center;color:red;font-size:16px;margin-bottom:20px;'>"
|
157 |
-
"This
|
158 |
"Chat only. For tool use, MCP support, and web search, please refer to the API.</div>"
|
159 |
-
"<div style='text-align:center;'><a href='https://huggingface.co/
|
160 |
-
"<a href='https://github.com/
|
161 |
-
"<a href='https://
|
162 |
)
|
163 |
raw_history = gr.State([])
|
164 |
|
|
|
13 |
client = OpenAI()
|
14 |
|
15 |
response = client.chat.completions.create(
|
16 |
+
model="GLM-4.5",
|
17 |
messages=messages,
|
18 |
temperature=temperature,
|
19 |
stream=True,
|
|
|
25 |
}
|
26 |
}
|
27 |
)
|
|
|
|
|
28 |
for chunk in response:
|
29 |
if stop_generation:
|
30 |
break
|
|
|
146 |
return [], [], ""
|
147 |
|
148 |
|
149 |
+
demo = gr.Blocks(title="GLM-4.5 API Demo", theme=gr.themes.Soft())
|
150 |
|
151 |
with demo:
|
152 |
gr.HTML(
|
153 |
+
"<div style='text-align:center;font-size:32px;font-weight:bold;margin-bottom:10px;'>GLM-4.5 API Demo</div>"
|
154 |
"<div style='text-align:center;color:red;font-size:16px;margin-bottom:20px;'>"
|
155 |
+
"This demo uses the API version of the service for faster response.<br>"
|
156 |
"Chat only. For tool use, MCP support, and web search, please refer to the API.</div>"
|
157 |
+
"<div style='text-align:center;'><a href='https://huggingface.co/zai-org/GLM-4.5'>Model Hub</a> | "
|
158 |
+
"<a href='https://github.com/zai-org/GLM-4.5'>Github</a> | "
|
159 |
+
"<a href='https://docs.bigmodel.cn/cn/guide/models/text/glm-4.5'>API</a></div>"
|
160 |
)
|
161 |
raw_history = gr.State([])
|
162 |
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
gradio==5.
|
2 |
spaces==0.39.0
|
3 |
openai==1.97.1
|
|
|
1 |
+
gradio==5.38.2
|
2 |
spaces==0.39.0
|
3 |
openai==1.97.1
|