Use Pillow==9.5.0

#50
by hysts HF staff - opened
Knowledge Engineering Group (KEG) & Data Mining at Tsinghua University org

I'm seeing the following error in the log:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 285, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1923, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1508, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
  File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 818, in wrapper
    response = f(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 818, in wrapper
    response = f(*args, **kwargs)
  File "/home/user/app/app.py", line 231, in generate
    gif_path = convert_to_gif(video_path)
  File "/home/user/app/app.py", line 131, in convert_to_gif
    clip = clip.resize(height=240)
  File "/usr/local/lib/python3.10/site-packages/moviepy/video/fx/resize.py", line 152, in resize
    newclip = clip.fl_image(fl)
  File "/usr/local/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 490, in fl_image
    return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
  File "/usr/local/lib/python3.10/site-packages/moviepy/Clip.py", line 136, in fl
    newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
  File "<decorator-gen-61>", line 2, in set_make_frame
  File "/usr/local/lib/python3.10/site-packages/moviepy/decorators.py", line 14, in outplace
    f(newclip, *a, **k)
  File "/usr/local/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 644, in set_make_frame
    self.size = self.get_frame(0).shape[:2][::-1]
  File "<decorator-gen-11>", line 2, in get_frame
  File "/usr/local/lib/python3.10/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "/usr/local/lib/python3.10/site-packages/moviepy/Clip.py", line 93, in get_frame
    return self.make_frame(t)
  File "/usr/local/lib/python3.10/site-packages/moviepy/Clip.py", line 136, in <lambda>
    newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
  File "/usr/local/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 490, in <lambda>
    return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
  File "/usr/local/lib/python3.10/site-packages/moviepy/video/fx/resize.py", line 150, in <lambda>
    fl = lambda pic: resizer(pic.astype('uint8'), newsize)
  File "/usr/local/lib/python3.10/site-packages/moviepy/video/fx/resize.py", line 37, in resizer
    resized_pil = pilim.resize(newsize[::-1], Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

I think this is because moviepy depends on Pillow<10, but the latest Pillow seems to be installed in this Space. Specifying Pillow version fixes this error.

Knowledge Engineering Group (KEG) & Data Mining at Tsinghua University org

Let me just force-merge this as the Space is not working properly.

hysts changed pull request status to merged
Knowledge Engineering Group (KEG) & Data Mining at Tsinghua University org

Thks!

Sign up or log in to comment