Spaces:
Running on Zero
Running on Zero
Add return type hint to generate endpoint
Browse filesGradio's API engine was dropping the streamed JSON yields because the
function declared no return type (warnings: 'returned too many output
values (needed: 0, returned: 1). Ignoring extra values.'). Adding
'-> str' so the yielded JSON strings are forwarded to the SSE stream
and reach the JS client.
Co-Authored-By: GLM-5.2 <noreply@z.ai>
app.py
CHANGED
|
@@ -162,7 +162,7 @@ def generate(
|
|
| 162 |
history: list = None,
|
| 163 |
max_new_tokens: int = DEFAULT_MAX_NEW_TOKENS,
|
| 164 |
temperature: float = DEFAULT_TEMPERATURE,
|
| 165 |
-
):
|
| 166 |
# Stream an Ornith-1.0-9B completion; yields JSON strings with
|
| 167 |
# {reasoning, answer, status, error}.
|
| 168 |
if history is None:
|
|
|
|
| 162 |
history: list = None,
|
| 163 |
max_new_tokens: int = DEFAULT_MAX_NEW_TOKENS,
|
| 164 |
temperature: float = DEFAULT_TEMPERATURE,
|
| 165 |
+
) -> str:
|
| 166 |
# Stream an Ornith-1.0-9B completion; yields JSON strings with
|
| 167 |
# {reasoning, answer, status, error}.
|
| 168 |
if history is None:
|