akhaliq HF Staff GLM-5.2 commited on
Commit
32c3dcb
·
1 Parent(s): 4236cbe

Add return type hint to generate endpoint

Browse files

Gradio'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>

Files changed (1) hide show
  1. app.py +1 -1
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: