How to test API of a private space
Hi everyone,I have created a private test space using the example code:import gradio as gr

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

iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()And after checking how to test it via API using this description:image1456×862 60.5 KBI test it via CURL:curl -X POST https://milyiyo-test-api.hf.space/api/predict -H 'Content-Type: application/json' -d '{"data": ["Juan"]}'But I get a 404 error page sayingSorry, we can’t find the page you are looking for.Can someone help me figure out what I’m doing wrong?I also got the same error after making the space publicThanks in advance
2022-10-30T15:51:41Z
Hi@milyiyo!Can you try passing your HuggingFace api token in the header?Authorization: BearerWe’ll update the Api docs page as well!
2022-10-30T16:34:17Z
Thanks@freddyaboulton, providing it like you suggested, works
2022-11-22T10:24:34Z
Could you post a link to the updated API docs?Here is how I got it to work:$ curl -X POST https://yourspace.hf.space/run/predict -H 'Content-Type: application/json' -H 'Authorization: Bearer put_your_bearer_token_here' -d '{"data": ["Paul"]}'
2023-04-12T05:29:57Z
I’m facing the same issue. I have tried the method that you’ve mentioned but still getting 404 error for my private space api for my organization.
2023-04-12T20:55:42Z
hi@themeetjani, just tested this on a private repo API and sending the'Authorization: Bearer HF_TOKEN'is working fine. Make sure your token is a valid READ token