Zejun-Yang/AniPortrait

Gradio Web UI example failed

Closed this issue · 1 comments

After preparing model weights, I tried Gradio Web UI example.
I entered python -m scripts.app and I got errors below.
Do you have any ideas how to fix this problem?

Traceback (most recent call last):
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/gradio/queueing.py", line 522, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/gradio/route_utils.py", line 260, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/gradio/blocks.py", line 1689, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/gradio/blocks.py", line 1255, in call_function
    prediction = await anyio.to_thread.run_sync(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/gradio/utils.py", line 750, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/Desktop/git_default/github.com/Zejun-Yang/AniPortrait/scripts/app.py", line 157, in audio2video
    lmk_extractor = LMKExtractor()
                    ^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/Desktop/git_default/github.com/Zejun-Yang/AniPortrait/src/utils/mp_utils.py", line 30, in __init__
    self.detector = face_landmark.FaceLandmarker.create_from_options(options)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/Desktop/git_default/github.com/Zejun-Yang/AniPortrait/src/utils/face_landmark.py", line 3165, in create_from_options
    task_info.generate_graph_config(
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/mediapipe/tasks/python/core/task_info.py", line 97, in generate_graph_config
    node_config.options.CopyFrom(task_subgraph_options)
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/google/protobuf/message.py", line 129, in CopyFrom
    self.MergeFrom(other_msg)
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/google/protobuf/internal/python_message.py", line 1334, in MergeFrom
    field_value = field._default_constructor(self)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FieldDescriptor' object has no attribute '_default_constructor'
Traceback (most recent call last):
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/gradio/queueing.py", line 522, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/gradio/route_utils.py", line 260, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/gradio/blocks.py", line 1689, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/gradio/blocks.py", line 1255, in call_function
    prediction = await anyio.to_thread.run_sync(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/gradio/utils.py", line 750, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/Desktop/git_default/github.com/Zejun-Yang/AniPortrait/scripts/app.py", line 157, in audio2video
    lmk_extractor = LMKExtractor()
                    ^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/Desktop/git_default/github.com/Zejun-Yang/AniPortrait/src/utils/mp_utils.py", line 30, in __init__
    self.detector = face_landmark.FaceLandmarker.create_from_options(options)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daisukeakagawa/Desktop/git_default/github.com/Zejun-Yang/AniPortrait/src/utils/face_landmark.py", line 3165, in create_from_options
    task_info.generate_graph_config(
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/mediapipe/tasks/python/core/task_info.py", line 97, in generate_graph_config
    node_config.options.CopyFrom(task_subgraph_options)
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/google/protobuf/message.py", line 129, in CopyFrom
    self.MergeFrom(other_msg)
  File "/Users/daisukeakagawa/.pyenv/versions/3.11.6/envs/AniPortrait/lib/python3.11/site-packages/google/protobuf/internal/python_message.py", line 1334, in MergeFrom
    field_value = field._default_constructor(self)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FieldDescriptor' object has no attribute '_default_constructor'

This problem was fixed by following below
google-ai-edge/mediapipe#5188 (comment)