zetavg commited on
Commit
60ce564
1 Parent(s): 49b832f

fix “AttributeError: module 'PIL.Image' has no attribute 'Resampling'”

Browse files

│ in <cell line: 1>:1 │
│ │
│ /usr/local/lib/python3.9/dist-packages/gradio/__init__.py:3 in <module> │
│ │
│ 1 import pkgutil │
│ 2 │
│ ❱ 3 import gradio.components as components │
│ 4 import gradio.inputs as inputs │
│ 5 import gradio.outputs as outputs │
│ 6 import gradio.processing_utils │
│ │
│ /usr/local/lib/python3.9/dist-packages/gradio/components.py:30 in <module> │
│ │
│ 27 import numpy as np │
│ 28 import pandas as pd │
│ 29 import PIL │
│ ❱ 30 import PIL.ImageOps │
│ 31 import requests │
│ 32 from fastapi import UploadFile │
│ 33 from ffmpy import FFmpeg │
│ │
│ /usr/local/lib/python3.9/dist-packages/PIL/ImageOps.py:240 in <module> │
│ │
│ 237 │ return _lut(image, red + green + blue) │
│ 238 │
│ 239 │
│ ❱ 240 def contain(image, size, method=Image.Resampling.BICUBIC): │
│ 241 │ """ │
│ 242 │ Returns a resized version of the image, set to the maximum width and height │
│ 243 │ within the requested size, while maintaining the original aspect ratio. │
│ │
│ /usr/local/lib/python3.9/dist-packages/PIL/Image.py:77 in __getattr__ │
│ │
│ 74 │ │ deprecate( │
│ 75 │ │ │ name, 10, f"{old_resampling[name]} or Resampling.{old_resampling[name]}" │
│ 76 │ │ ) │
│ ❱ 77 │ │ return Resampling[old_resampling[name]] │
│ 78 │ msg = f"module '{__name__}' has no attribute '{name}'" │
│ 79 │ raise AttributeError(msg) │
│ 80 │

Files changed (1) hide show
  1. requirements.lock.txt +1 -1
requirements.lock.txt CHANGED
@@ -68,7 +68,7 @@ pathspec==0.11.1
68
  peft @ git+https://github.com/huggingface/peft.git@deff03f2c251534fffd2511fc2d440e84cc54b1b
69
  pexpect==4.8.0
70
  pickleshare==0.7.5
71
- Pillow==9.5.0
72
  pkgutil_resolve_name==1.3.10
73
  platformdirs==3.2.0
74
  pluggy==1.0.0
 
68
  peft @ git+https://github.com/huggingface/peft.git@deff03f2c251534fffd2511fc2d440e84cc54b1b
69
  pexpect==4.8.0
70
  pickleshare==0.7.5
71
+ Pillow==9.3.0
72
  pkgutil_resolve_name==1.3.10
73
  platformdirs==3.2.0
74
  pluggy==1.0.0