Commit ·
c8d596f
1
Parent(s): 97bc9b2
Annotate generate_bulletin return type so Gradio routes 2 outputs
Browse files@app .api infers output count from the return annotation; without one
Gradio assumed 0 outputs and dropped (status, html) on the floor, so
the frontend never received any payload and stayed on Connecting....
app.py
CHANGED
|
@@ -7,6 +7,7 @@ from the original Blocks app.
|
|
| 7 |
|
| 8 |
import os
|
| 9 |
from pathlib import Path
|
|
|
|
| 10 |
|
| 11 |
from fastapi.responses import HTMLResponse
|
| 12 |
from gradio import Server
|
|
@@ -28,7 +29,9 @@ def _owner_from(repo_id: str) -> str:
|
|
| 28 |
|
| 29 |
|
| 30 |
@app.api(name="generate_bulletin", concurrency_limit=1)
|
| 31 |
-
def generate_bulletin(
|
|
|
|
|
|
|
| 32 |
"""Streams (status, html) updates; final tick carries the bulletin HTML."""
|
| 33 |
|
| 34 |
yield "Connecting…", empty_bulletin_html("Connecting…")
|
|
|
|
| 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
|
|
|
|
| 29 |
|
| 30 |
|
| 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…")
|