I'm following the basic Gradio interface from the Gradio documentation:
import gradio as gr
def greet(name):
return "Hello " + name + "!"
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()
The interface is:
I believe this deploys a RESTful API, since it says "Use via API" in the footer of the interface:
How can I call that RESTful API with Postman?
I tried:
but as the screenshot shows, I'm getting the error message:
{"detail":"Not Found"}
The page that the "Use via API" points to indicate:
but I don't want to use the Gradio client.
Update: using the endpoint http://localhost:7861/api/predict
seems to work better, but I am still trying to figure out what the name of the key is:
I tried to add a body but that doesn't work either:
I found the answer on https://github.com/aiplaybookin/gradio-demo:
In my case:
JSON payload: