mervenoyan commited on
Commit
ab999e5
·
1 Parent(s): c8d596f

Use tuple[str,str] return annotation so Gradio counts 2 outputs

Browse files

Iterator[tuple[...]] confused @app .api's output-count inference.
Annotating the yielded shape directly matches how Gradio Blocks handles
streaming generators.

Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -7,7 +7,6 @@ from the original Blocks app.
7
 
8
  import os
9
  from pathlib import Path
10
- from typing import Iterator
11
 
12
  from fastapi.responses import HTMLResponse
13
  from gradio import Server
@@ -31,7 +30,7 @@ def _owner_from(repo_id: str) -> str:
31
  @app.api(name="generate_bulletin", concurrency_limit=1)
32
  def generate_bulletin(
33
  repo_id: str, max_sessions: int
34
- ) -> Iterator[tuple[str, str]]:
35
  """Streams (status, html) updates; final tick carries the bulletin HTML."""
36
 
37
  yield "Connecting…", empty_bulletin_html("Connecting…")
 
7
 
8
  import os
9
  from pathlib import Path
 
10
 
11
  from fastapi.responses import HTMLResponse
12
  from gradio import Server
 
30
  @app.api(name="generate_bulletin", concurrency_limit=1)
31
  def generate_bulletin(
32
  repo_id: str, max_sessions: int
33
+ ) -> tuple[str, str]:
34
  """Streams (status, html) updates; final tick carries the bulletin HTML."""
35
 
36
  yield "Connecting…", empty_bulletin_html("Connecting…")