Update app.py
Browse files
app.py
CHANGED
|
@@ -26,8 +26,10 @@ def chat_stream(messages):
|
|
| 26 |
)
|
| 27 |
|
| 28 |
for chunk in stream:
|
| 29 |
-
if chunk.choices
|
| 30 |
-
|
|
|
|
|
|
|
| 31 |
|
| 32 |
def chat_respond(message, history):
|
| 33 |
"""
|
|
@@ -212,7 +214,7 @@ with gr.Blocks(fill_height=True) as demo:
|
|
| 212 |
|
| 213 |
# Header Title
|
| 214 |
gr.Markdown("""# GLM-4.7 CHAT""", elem_classes="header-text")
|
| 215 |
-
gr.Markdown("""<p class="subtitle">Zhipu AI's Latest Open Source Model - Powerful Reasoning
|
| 216 |
|
| 217 |
# Model Info Box
|
| 218 |
gr.HTML("""
|
|
|
|
| 26 |
)
|
| 27 |
|
| 28 |
for chunk in stream:
|
| 29 |
+
if chunk.choices and len(chunk.choices) > 0:
|
| 30 |
+
delta = chunk.choices[0].delta
|
| 31 |
+
if hasattr(delta, 'content') and delta.content:
|
| 32 |
+
yield delta.content
|
| 33 |
|
| 34 |
def chat_respond(message, history):
|
| 35 |
"""
|
|
|
|
| 214 |
|
| 215 |
# Header Title
|
| 216 |
gr.Markdown("""# GLM-4.7 CHAT""", elem_classes="header-text")
|
| 217 |
+
gr.Markdown("""<p class="subtitle">Zhipu AI's Latest Open Source Model - Powerful Reasoning and Coding Capabilities</p>""")
|
| 218 |
|
| 219 |
# Model Info Box
|
| 220 |
gr.HTML("""
|