microsoft / microsoft/OmniParser

TypeError: argument of type 'bool' is not iterable while running gradio

Open
#315 1 comment 0 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

(OmniParser)
Yash Sonar@DESKTOP-VMGVC7N MINGW64 ~/Desktop/GitHub-Repo/OmniParser (master)
$ python gradio_demo.py
INFO: Could not find files for the given pattern(s).
C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\paddle\utils\cpp_extension\extension_utils.py:715: UserWarning: No ccache
found. Please be aware that recompiling all source files may be required. You can download and install ccache from: https://github.com/ccache/ccache/
blob/master/doc/INSTALL.md
warnings.warn(warning_message)
Florence2LanguageForConditionalGeneration has generative capabilities, as prepare_inputs_for_generation is explicitly defined. However, it doesn't
directly inherit from GenerationMixin. From 👉v4.50👈 onwards, PreTrainedModel will NOT inherit from GenerationMixin, and this model will lose
the ability to call generate and other related functions.

  • If you're using trust_remote_code=True, you can get rid of this warning by loading the model with an auto class. See https://huggingface.co/doc
    s/transformers/en/model_doc/auto#auto-classes
  • If you are the owner of the model architecture code, please modify your model class such that it inherits from GenerationMixin (after PreTrain edModel, otherwise you'll get an exception).
  • If you are not the owner of the model architecture class, please contact the model code owner to update it.
  • Running on local URL: http://0.0.0.0:7861
    ERROR: Exception in ASGI application
    Traceback (most recent call last):
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 403, in run_asgi
    result = await app( # type: ignore[func-returns-value]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in call
    return await self.app(scope, receive, send)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\fastapi\applications.py", line 1054, in call
    await super().call(scope, receive, send)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette\applications.py", line 112, in call
    await self.middleware_stack(scope, receive, send)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette\middleware\errors.py", line 187, in call
    raise exc
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette\middleware\errors.py", line 165, in call
    await self.app(scope, receive, send)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\gradio\route_utils.py", line 789, in call
    await self.app(scope, receive, send)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
    raise exc
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette\routing.py", line 714, in call
    await self.middleware_stack(scope, receive, send)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette\routing.py", line 734, in app
    await route.handle(scope, receive, send)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette\routing.py", line 288, in handle
    await self.app(scope, receive, send)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette\routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
    raise exc
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette\routing.py", line 73, in app
    response = await f(request)
    ^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\fastapi\routing.py", line 301, in app
    raw_response = await run_endpoint_function(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\fastapi\routing.py", line 214, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\starlette\concurrency.py", line 37, in run_in_threadpool
    return await anyio.to_thread.run_sync(func)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thre
    ad
    return await future
    ^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\anyio_backends_asyncio.py", line 807, in run
    result = context.run(func, *args)
    ^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\gradio\routes.py", line 555, in main
    gradio_api_info = api_info(request)
    ^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\gradio\routes.py", line 585, in api_info
    api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\gradio\blocks.py", line 2926, in get_api_info
    python_type = client_utils.json_schema_to_python_type(info)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\gradio_client\utils.py", line 931, in json_schema_to_python_type
    type
    = _json_schema_to_python_type(schema, schema.get("$defs"))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\gradio_client\utils.py", line 986, in _json_schema_to_python_type
    f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\gradio_client\utils.py", line 993, in _json_schema_to_python_type
    f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\gradio_client\utils.py", line 939, in json_schema_to_python_type
    type
    = get_type(schema)
    ^^^^^^^^^^^^^^^^
    File "C:\Users\Yash Sonar\Desktop\GitHub-Repo\OmniParser.venv\Lib\site-packages\gradio_client\utils.py", line 898, in get_type
    if "const" in schema:
    ^^^^^^^^^^^^^^^^^
    TypeError: argument of type 'bool' is not iterable

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 by running gradio_demo.py and trace the failure from the app's API-info request into gradio blocks.get_api_info and gradio_client.utils.json_schema_to_python_type. Identify which schema value reaches get_type as a boolean, then verify that the Gradio app starts and its API-info request completes without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.