microsoft / microsoft/OmniParser

report a problem about running gradio_demo.py slowly

Open Beginner friendly
#197 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
25.4k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

When I executed gradio_demo.py, I noticed that it took an exceptionally long time without yielding any results. Upon inspecting the code, I found that there seems to be an issue with the execution of the submit_button_component.click in relation to the Gradio component.

When using queue=True(default), Gradio handles requests in a new process, which prevents the CUDA context from being shared between processes, causing the GPU model inference to hang. Setting queue=False allows requests to be processed directly in the main process, avoiding this issue.

submit_button_component.click(
        fn=process,
       ......
        queue=False 
    )

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in gradio_demo.py and inspect the submit_button_component.click configuration, especially its queue setting. Reproduce the slow or hanging execution, apply the issue's proposed request-processing change, and verify that the demo returns results without hanging during GPU model inference.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.