Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing through FRP renders generator useless #10317

Open
1 task done
libokj opened this issue Jan 9, 2025 · 0 comments
Open
1 task done

Sharing through FRP renders generator useless #10317

libokj opened this issue Jan 9, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@libokj
Copy link

libokj commented Jan 9, 2025

Describe the bug

Generator functions (sync or async) with while or for loop (which work smoothly as expected when accessing the app locally) only update the component with the last yield (breaking out of the loop) when accessing the app through FRP. Currently I'm not sure if this is a problem of gradio or the gradio fork of FRP, so I'll open a ticket here for now.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr
import asyncio

# Async version
async def async_query_job_status(job_id):
    for i in range(10):
        yield {
            status: gr.update(value=f"Async: Checking job {job_id}... Step {i+1}/10"),
        }
        await asyncio.sleep(3)  # Simulate async delay

# Sync version
def sync_query_job_status(job_id):
    import time
    for i in range(10):
        yield {
            status: gr.update(value=f"Sync: Checking job {job_id}... Step {i+1}/10"),
        }
        time.sleep(3)  # Simulate blocking delay

with gr.Blocks() as demo:
    with gr.Row():
        start_btn = gr.Button("Start Job")
    job_id_input = gr.Textbox(label="Job ID")
    status = gr.Markdown("Status will appear here")

    start_btn.click(
        async_query_job_status,  # sync_query_job_status,
        inputs=job_id_input,
        outputs=status,
    )

demo.launch(
    share=True,
    # share_server_address="my-frp-server.com:7000",
    # share_server_protocol="https",
)

Screenshot

No response

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 5.10.0
gradio_client version: 1.5.3

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.7.0
audioop-lts is not installed.
fastapi: 0.115.6
ffmpy: 0.4.0
gradio-client==1.5.3 is not installed.
httpx: 0.28.1
huggingface-hub: 0.26.5
jinja2: 3.1.4
markupsafe: 2.1.5
numpy: 1.23.5
orjson: 3.10.12
packaging: 24.2
pandas: 2.2.3
pillow: 10.4.0
pydantic: 2.10.3
pydub: 0.25.1
python-multipart: 0.0.19
pyyaml: 6.0.2
ruff: 0.8.2
safehttpx: 0.1.6
semantic-version: 2.10.0
starlette: 0.41.3
tomlkit: 0.12.0
typer: 0.15.1
typing-extensions: 4.12.2
urllib3: 2.2.3
uvicorn: 0.32.1
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2024.10.0
httpx: 0.28.1
huggingface-hub: 0.26.5
packaging: 24.2
typing-extensions: 4.12.2
websockets: 12.0

Severity

I can work around it

@libokj libokj added the bug Something isn't working label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant