zRzRzRzRzRzRzR commited on
Commit
cfdacf5
Β·
1 Parent(s): 26295fb
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +7 -9
  3. requirements.txt +1 -1
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: GLM 4.5 Space
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="glm-4.5",
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 Space", theme=gr.themes.Soft())
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 Space</div>"
156
  "<div style='text-align:center;color:red;font-size:16px;margin-bottom:20px;'>"
157
- "This space uses the API version of the service for faster response.<br>"
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/THUDM/GLM-4.5'>Model Hub</a> | "
160
- "<a href='https://github.com/THUDM/GLM-4.5'>Github</a> | "
161
- "<a href='https://www.bigmodel.cn'>API</a></div>"
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.25.0
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