Create API Endpoint from hugging face space

Hello everyone,

I have created a Space on Hugging Face that runs my custom machine-learning model using Gradio. It works perfectly in the web interface, but now I want to convert this Space into an API endpoint that I can call from my application.

Could someone guide me through the process of converting my Hugging Face Space to an API endpoint? Specifically, I am looking for:

  1. Steps to set up an Inference Endpoint from my existing Space.
  2. How to handle authentication and API keys for accessing the endpoint.
  3. Any best practices or tips for optimizing the performance of the endpoint.

Thanks in advance for your help!