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

gr.File with file_types="image" breaks front-end rendering #3043

Closed
1 task done
apolinario opened this issue Jan 23, 2023 · 4 comments · Fixed by #3048
Closed
1 task done

gr.File with file_types="image" breaks front-end rendering #3043

apolinario opened this issue Jan 23, 2023 · 4 comments · Fixed by #3048
Assignees
Labels
bug Something isn't working

Comments

@apolinario
Copy link
Contributor

apolinario commented Jan 23, 2023

Describe the bug

If a gr.File contains the file_types="image" the front-end never renders due to a Uncaught (in promise) TypeError: i.map is not a function in the browser console
image

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

import gradio as gr
with gr.Blocks() as demo:
    gr.File(label="Test", file_count="multiple", interactive=True, file_types="image"demo.launch()

https://huggingface.co/spaces/multimodalart/grFileBug

Screenshot

No response

Logs

FileUpload.svelte:49 Uncaught (in promise) TypeError: i.map is not a function
    at Ce (FileUpload.svelte:49:27)
    at Pt (index.4395ab38.js:4:6005)
    at new Ee (FileUpload.svelte:60:30)
    at Array.Me (File.svelte:57:16)
    at Array.Se (File.svelte:40:16)
    at jn (index.4395ab38.js:1:1425)
    at _n (index.4395ab38.js:76:13914)
    at Wc (index.4395ab38.js:76:14690)
    at Pt (index.4395ab38.js:4:6206)
    at new Zc (index.4395ab38.js:76:16107)

System Info

gradio==3.16.2

Severity

blocking upgrade to latest gradio version

@apolinario apolinario added the bug Something isn't working label Jan 23, 2023
@apolinario apolinario changed the title gr.File with file_types="image" breaks gr.File with file_types="image" breaks front-end rendering Jan 23, 2023
@apolinario
Copy link
Contributor Author

PS: Works perfectly in Gradio 3.15, but breaks from 3.16.0 to 3.16.2

@freddyaboulton
Copy link
Collaborator

@apolinario Can you try with

gr.File(label="Test", file_count="multiple", interactive=True, file_types=["image"])

Works for me on main right now

image

@freddyaboulton freddyaboulton self-assigned this Jan 23, 2023
@apolinario
Copy link
Contributor Author

That works! Somehow I had old code that did not use a list and it used to work - so that broke on 3.16.x - but as a list it did work!

@freddyaboulton
Copy link
Collaborator

Glad it works! Will put up a PR to check that file_types is a list and raise an error to prevent front-end crashing

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

Successfully merging a pull request may close this issue.

2 participants