Deploying a Hugging Face app on Vercel can be done in several steps. Here is how to do it:
Step 1: Create the app on Hugging Face
Firstly, you need to create your app on Hugging Face. To do this, go to the Hugging Face website and sign up for an account. Once you have signed up, create a new app from the dashboard.
Step 2: Clone the app
After you have created your app, clone the app’s GitHub repository to your development environment. You can do this by running the following commands:
$ git clone
$ cd
Step 3: Install dependencies
Next, install the dependencies required by the app. You can do this by running the following command inside the cloned repository:
$ pip install -r requirements.txt
Step 4: Test the app
Before you can deploy the app, it’s important to test it to make sure it’s working as it should. Run the following command to test your app:
$ uvicorn main:app --reload
The above command will start the server and the app can be accessed by the following the local link http://localhost:8000/. Check if your app is working fine.
Step 5: Deploy on Vercel
To deploy the app on Vercel you will also require an account with them, sign up if you haven't. Once you have signed up, login to your Vercel account and create a new project. On the project creation dialog box, select “Import Project” and provide the GitHub repository URL for your app. Once the repo is imported, Vercel will automatically detect that it’s a Python based app and build it.
On the "Environment Variables" section of the project’s dashboard, set the environment variables which your app will be using, such as the models directory, model name and other relevant settings.
Finally, once all the environment variables have been set, hit the “Deploy” button, sit back and wait for Vercel to deploy your app. Once the deployment has been complete, your app will be live and accessible via the URL assigned to the service.
Example:
Here is an example of how to deploy a Hugging Face app on Vercel:
Step 1: Go to https://huggingface.co/ and sign up for an account. Create your new app from the dashboard.
Step 2: Clone the app’s GitHub repository:
$ git clone https://github.com/huggingface/myapp.git
$ cd myapp
Step 3: Install dependencies:
$ pip install -r requirements.txt
Step 4: Test the app:
$ uvicorn main:app --reload
Step 5: Deploy on Vercel:
- Login to your Vercel account and create a new project.
- On the “Import Project” dialog box, provide the GitHub repository URL for your app.
- On the “Environment Variables” section, set the relevant environment variables, such as the models directory, model name and other settings.
- Hit the “Deploy” button to deploy your app.