FastAPI 0.100.0 breaks gradio
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.There is a fix in#4835, but I wanted to leave this here in case other people run into the same problem.Again, my quick and temporary fix was to pin FastAPI back to 0.99.0.
2023-07-08T16:09:57Z
Another fix now is to install the latest gradio (3.36.1)
2023-07-11T19:53:43Z
Hello,I’m sorry to hear about the difficulties you’re experiencing. It sounds like you’re running into a known issue with Gradio versions prior to 3.36.1 on Spaces. This issue arises from a breaking change in Pydantic 2.0, recently incorporated by FastAPI, which can cause Spaces to crash on restart.However, there’s no need to worry as we have a solution in place. We suggest you upgrade Gradio to 3.36.1 in all your Spaces (you can do this in the Gradio SDK section in a Space’s readme.md file). This update should rectify the issue. If you’re using Gradio locally, you’ll need to upgrade only if you’ve updated to the recent FastAPI/Pydantic versions.To prevent any potential disruptions, it’s strongly advised to update to Gradio 3.36.1. We’ve made an announcement regarding this on our Discord channel to remind our users about this critical update. You can view it here - [Discord Link] (Discord)I trust this information proves useful! If you have further questions or require more support, please don’t hesitate to reach out.
2023-07-11T22:31:48Z
Thanks@ysharma. Yeah, I saw the 3.36.1 release on github and updated my versions.That was released so quick ! Amazing.
2023-08-11T08:28:15Z
Thanks a lot@thiagohersanfor taking the time to create this issue. It helped me solved my problem.