Help with api on spaces

Hi, I’ve created a simple app, its a docker file with a fastAPI api. There are 2 endpoints. GET (“/”) and POST (“/inference”). After the building process, I can see the Hello Work working ok on the browser. But im enable to reach it from curl. The app is served at 5000 port. If i do it like this:

curl -X GET --location ‘https://huggingface.co/spaces/my_user/myspace’ --header ‘Content-Type: application/json’ --header ‘Authorization: Bearer <MY_HG_TOKEN>’
I get the html

If i do it like this
curl -X GET --location ‘https://huggingface.co/spaces/my_user/myspace:5000’ --header ‘Content-Type: application/json’ --header ‘Authorization: Bearer <MY_HG_TOKEN>’
I get {“error”:“Invalid username or password.”}:

I added the app_port to the README

Any ideas what Im missing ?

The only thing I can think of is to use this URL instead, which seems to be an alias or main body of Spaces.
https://my_user-myspace.hf.space/

Thanks for the answer Jhon goona give it a try-

Yeap, using that url works like a charm. Thanks again.

1 Like

I didn’t think it would work out that well. Well, thank goodness.:grinning: