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

FastAPI 0.100.0 breaks gradio #4840

Closed
1 task done
thiagohersan opened this issue Jul 8, 2023 · 3 comments
Closed
1 task done

FastAPI 0.100.0 breaks gradio #4840

thiagohersan opened this issue Jul 8, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@thiagohersan
Copy link

thiagohersan commented Jul 8, 2023

Describe the bug

I had to restart some containers on Huggingface spaces and afterwards none of them would work.
It was strange because most of my few dependencies were pinned.

What would happen:
Examples would run and cache, but Interface would show Error right away whenever I interacted with any of the UI elements. Even hitting the "clear" button would throw an error on the UI, but no error on the python logs.

Same thing happened on Docker spaces if I forced image rebuild.

When debugging locally I noticed a similar situation, no errors on the command line, but I did notice there were errors on my browser console:

POST http://127.0.0.1:7860/run/predict 422 (Unprocessable Entity)

After some googling, I guessed it had to do with FastAPI and their new release, so I pinned FastAPI to version 0.99.0 and all is fine again.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

Install gradio 3.23.0 (although same error occurs in 3.16.2) via conda and run a minimal example.
Even the Interfaces example bugs out:

import gradio as gr

def greet(name):
    return "Hello " + name + "!"

demo = gr.Interface(fn=greet, inputs="text", outputs="text")
    
if __name__ == "__main__":
    demo.launch()   

Screenshot

Screenshot 2023-07-08 at 11 27 25

Logs

No Python errors.

This is the JavaScript error:

POST http://127.0.0.1:7860/run/predict 422 (Unprocessable Entity)

Full log:

index.37b24c07.js:4
POST http://127.0.0.1:7860/run/predict 422 (Unprocessable Entity)
Fr @ index.37b24c07.js:4
(anonymous) @ index.37b24c07.js:4
N @ index.37b24c07.js:4
k @ index.37b24c07.js:4
ue @ Blocks.svelte:303
ze @ Blocks.svelte:298
(anonymous) @ Blocks.svelte:342
(anonymous) @ index.37b24c07.js:4
zr @ index.37b24c07.js:4
_ @ Button.svelte:12
(anonymous) @ index.37b24c07.js:4
zr @ index.37b24c07.js:4
c @ Button.svelte:11

System Info

Gradio 3.23.0 (and 3.16.2)
Mac OS Ventura and Linux Ubuntu 20
Chrome 114

Severity

I can work around it

@thiagohersan thiagohersan added the bug Something isn't working label Jul 8, 2023
@thiagohersan
Copy link
Author

I am guessing the latest PR pulled into main (#4835) will fix this....

@freddyaboulton
Copy link
Collaborator

Hi @thiagohersan ! You should either install the latest gradio (3.36.1) or pin pydantic at version 1 (pip install pydantic==1.*)

@thiagohersan
Copy link
Author

So fresh ! Amazing how quickly y'all pushed that. Thanks so much.
🎉✨

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