Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIL.UnidentifiedImageError: cannot identify image file .avif' #10381

Closed
FurkanGozukara opened this issue Jan 17, 2025 · 1 comment
Closed

PIL.UnidentifiedImageError: cannot identify image file .avif' #10381

FurkanGozukara opened this issue Jan 17, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@FurkanGozukara
Copy link

FurkanGozukara commented Jan 17, 2025

Can we make Gradio to convert uploaded .avif into PNG?

This is how I am getting the image file

image_prompt = gr.Image(type="pil", label="Image Prompt", height=500)

error

Traceback (most recent call last):
  File "F:\CogVLM2_v4\venv\lib\site-packages\gradio\queueing.py", line 625, in process_events
    response = await route_utils.call_process_api(
  File "F:\CogVLM2_v4\venv\lib\site-packages\gradio\route_utils.py", line 322, in call_process_api
    output = await app.get_blocks().process_api(
  File "F:\CogVLM2_v4\venv\lib\site-packages\gradio\blocks.py", line 2038, in process_api
    inputs = await self.preprocess_data(
  File "F:\CogVLM2_v4\venv\lib\site-packages\gradio\blocks.py", line 1733, in preprocess_data
    processed_input.append(block.preprocess(inputs_cached))
  File "F:\CogVLM2_v4\venv\lib\site-packages\gradio\components\image.py", line 210, in preprocess
    im = PIL.Image.open(file_path)
  File "F:\CogVLM2_v4\venv\lib\site-packages\PIL\Image.py", line 3298, in open
    raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file 'C:\\Users\\Furkan\\AppData\\Local\\Temp\\gradio\\49ffd6af56c94f280c7ab1b75ab44501673d0c211fbc7f340bece24783f03346\\NationalGeographic_2760047_3x4.avif'

gradio==5.12.0

Severity

Blocking usage of gradio

The image is valid and Gradio displays it

@FurkanGozukara FurkanGozukara added the bug Something isn't working label Jan 17, 2025
@abidlabs
Copy link
Member

This is something that PIL would need to support for us to support in Gradio, but it looks like they are working on it: python-pillow/Pillow#5201

Once supported, using the latest version of PIL should automatically work in Gradio.

@abidlabs abidlabs closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants