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

gradio {"detail":"Method Not Allowed"} #4591

Closed
1 task done
wccccp opened this issue Jun 21, 2023 · 10 comments
Closed
1 task done

gradio {"detail":"Method Not Allowed"} #4591

wccccp opened this issue Jun 21, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@wccccp
Copy link

wccccp commented Jun 21, 2023

Describe the bug

gr.Interface(fn=generate_answer, inputs=inputs, outputs=outputs, title=title, description=description, examples=examples).launch(share=True,server_name="172.16.1.88",server_port=7877,)

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

I wanted to request the URL using the API, but it failed

Screenshot

No response

Logs

No response

System Info

Name: gradio
Version: 3.28.3
Summary: Python library for easily interacting with trained machine learning models
Home-page: 
Author: 
Author-email: Abubakar Abid <team@gradio.app>, Ali Abid <team@gradio.app>, Ali Abdalla <team@gradio.app>, Dawood Khan <team@gradio.app>, Ahsen Khaliq <team@gradio.app>, Pete Allen <team@gradio.app>, Ömer Faruk Özdemir <team@gradio.app>
License: 
Location: /home/wangchenpeng/miniconda3/envs/glm/lib/python3.9/site-packages
Requires: aiofiles, aiohttp, altair, fastapi, ffmpy, gradio-client, httpx, huggingface-hub, jinja2, markdown-it-py, markupsafe, matplotlib, mdit-py-plugins, numpy, orjson, pandas, pillow, pydantic, pydub, pygments, python-multipart, pyyaml, requests, semantic-version, typing-extensions, uvicorn, websockets
Required-by:

Severity

I can work around it

@wccccp wccccp added the bug Something isn't working label Jun 21, 2023
@freddyaboulton
Copy link
Collaborator

Hi @wccccp - what was the code you used "for request the URL using the API"? Thanks! Would help us debug.

@wccccp
Copy link
Author

wccccp commented Jun 24, 2023

Hi @wccccp - what was the code you used "for request the URL using the API"? Thanks! Would help us de
I deployed a bert model with gradio, I want to generate results with the deployed model, I can start the web port normally, but I can't call the url in the python script

@abidlabs
Copy link
Member

abidlabs commented Jul 5, 2023

Hi @wccccp we can't debug this without a self-contained example with code. Closing for now, but happy to look into it if you provide us a repro

@abidlabs abidlabs closed this as completed Jul 5, 2023
@chenzba
Copy link

chenzba commented Jul 11, 2023

I got thisi problem too, and I set the show_error=True, then the xxx/run/predict api return:
{"detail":[{"type":"missing","loc":["body","event_id"],"msg":"Field required","input":{"data":["test"],"event_data":null,"fn_index":0,"session_hash":"p9c60n82pdj"},"url":"https://errors.pydantic.dev/2.1.2/v/missing"}]}
my pydantic version is:2.0.2

@freddyaboulton
Copy link
Collaborator

Hi @chenzba - if you're using pydantic version 2.0 the demo needs to be running version gradio 3.36.1!

@chenzba
Copy link

chenzba commented Jul 11, 2023

Hi @chenzba - if you're using pydantic version 2.0 the demo needs to be running version gradio 3.36.1!

thanks for answer. My gradio is 3.35.2, which version of pydantic is best. Thanks!

@freddyaboulton
Copy link
Collaborator

If you can't upgrade gradio, pin pydantic to version 1 (pip install pydantic=1.*)

@segments-tobias
Copy link

I had the same issue and pinning pydantic fixed it for me. It's not ideal though, since I never had to specify pydantic in my requirements.txt before. So ideally old Gradio versions should not install pydantic 2. automatically if they're not compatible with it.

@abidlabs
Copy link
Member

Hi @segments-tobias that's fair -- but unfortunately pydantic 2.* is incompatible with pydantic 1.* and there's no way for us to go back and edit old releases of gradio

@segments-tobias
Copy link

Understood, thanks for the help!

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

5 participants