ProjectNUWA / DragNUWA

730 stars 68 forks source link

ValueError: `x` must contain at least 2 elements. #20

Open nathanshipley opened 8 months ago

nathanshipley commented 8 months ago

Ubuntu 22. Followed README instructions, created environment, downloaded the model, Gradio interface launches. I add some arrows, click run, and get this error:

Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.
You selected None at [425, 108] from image
You selected None at [385, 93] from image
You selected None at [345, 87] from image
You selected None at [219, 239] from image
You selected None at [264, 242] from image
You selected None at [303, 239] from image
You selected None at [183, 122] from image
You selected None at [143, 123] from image
You selected None at [105, 128] from image
Traceback (most recent call last):
  File "/home/nathan/anaconda3/envs/DragNUWA/lib/python3.8/site-packages/gradio/queueing.py", line 495, in call_prediction
    output = await route_utils.call_process_api(
  File "/home/nathan/anaconda3/envs/DragNUWA/lib/python3.8/site-packages/gradio/route_utils.py", line 232, in call_process_api
    output = await app.get_blocks().process_api(
  File "/home/nathan/anaconda3/envs/DragNUWA/lib/python3.8/site-packages/gradio/blocks.py", line 1561, in process_api
    result = await self.call_function(
  File "/home/nathan/anaconda3/envs/DragNUWA/lib/python3.8/site-packages/gradio/blocks.py", line 1179, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/home/nathan/anaconda3/envs/DragNUWA/lib/python3.8/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/home/nathan/anaconda3/envs/DragNUWA/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 2134, in run_sync_in_worker_thread
    return await future
  File "/home/nathan/anaconda3/envs/DragNUWA/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 851, in run
    result = context.run(func, *args)
  File "/home/nathan/anaconda3/envs/DragNUWA/lib/python3.8/site-packages/gradio/utils.py", line 678, in wrapper
    response = f(*args, **kwargs)
  File "DragNUWA_demo.py", line 152, in run
    splited_track = interpolate_trajectory(splited_track, self.model_length)
  File "DragNUWA_demo.py", line 21, in interpolate_trajectory
    fx = PchipInterpolator(t, x)
  File "/home/nathan/anaconda3/envs/DragNUWA/lib/python3.8/site-packages/scipy/interpolate/_cubic.py", line 234, in __init__
    x, _, y, axis, _ = prepare_input(x, y, axis)
  File "/home/nathan/anaconda3/envs/DragNUWA/lib/python3.8/site-packages/scipy/interpolate/_cubic.py", line 46, in prepare_input
    raise ValueError("`x` must contain at least 2 elements.")
ValueError: `x` must contain at least 2 elements.

Any ideas? Screenshot from 2024-01-17 10-31-50

nathanshipley commented 8 months ago

I figured out a hack to work around this. Before, if I just create drags and then press Run, I get the ValueError mentioned above.

Fix: Create an extra drag I don't want, and then press Delete last drag and Run executes successfully.