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

fix: update api_server_backend.py to adapt latest gradio #1541

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kv-chiu
Copy link

@kv-chiu kv-chiu commented May 3, 2024

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily receiving feedbacks. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

I tried to run the demo, but ran into two bugs

  1. concurrency_count

image

  1. no update method

image

Modification

  1. remove concurrency_count
  2. fix Textbox.update to Textbox.postprocess(self, value: str)

ref:

  1. gradio update log
    Breaking Changes in Gradio 4.0 gradio-app/gradio#6339
  2. gradio Blocks docs
    https://www.gradio.app/docs/gradio/blocks#blocks-queue
  3. gradio Textbox docs
    https://www.gradio.app/docs/gradio/textbox

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

image

image

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@lvhan028 lvhan028 requested review from irexyc and AllentDan May 5, 2024 06:54
@AllentDan
Copy link
Collaborator

Currently, lmdeploy gradio demos use gradio<4.0.0. I notice the change is BC breaking, does it mean gradio<4.0.0 can not run the demo because of fix Textbox.update to Textbox.postprocess(self, value: str)

@kv-chiu
Copy link
Author

kv-chiu commented May 6, 2024

Currently, lmdeploy gradio demos use gradio<4.0.0. I notice the change is BC breaking, does it mean gradio<4.0.0 can not run the demo because of fix Textbox.update to Textbox.postprocess(self, value: str)

image

have fixed it:

image

@AllentDan
Copy link
Collaborator

Hi, @kv-chiu I tested the PR with gradio 4.29.0, and got the following error when clicking Reset button.

lmdeploy/serve/gradio/api_server_backend.py", line 80, in reset_restful_func
    gr.Textbox.update(value=''),
AttributeError: type object 'Textbox' has no attribute 'update'

@AllentDan
Copy link
Collaborator

there are linting errors, which can fixed by running the following commands:

pip install pre-commit
cd the/root/path/of/lmdeploy
pre-commit install .
pre-commit run --all-files

@lvhan028
Copy link
Collaborator

lvhan028 commented May 6, 2024

@irexyc may review if VLM demo works

@kv-chiu
Copy link
Author

kv-chiu commented May 6, 2024

@AllentDan

fixed (using gradio==4.29.0, If you encounter the error 'No module named "gradio_client",' simply reinstall Gradio to resolve the issue.)

QQ202456-173610.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants