Can I use Spaces to host an API (not a demo site)

@John6666 Thanks so much for the response. I read thru them and implemented like so:

demo = gr.Interface(fn=predict, inputs='text', outputs='label')
demo.launch(strict_cors=False, share=True)

The log of my Space then says …

/usr/local/lib/python3.10/site-packages/gradio/blocks.py:2597: UserWarning: Setting share=True is not supported on Hugging Face Spaces
  warnings.warn(

To create a public link, set `share=True` in `launch()`.

This is super confusing. It looks like Hugging Face doesn’t allow API access to Spaces. What am I missing?

1 Like