Huggingface.co
Deploy your RAG application to huggingface.co platform
With Embedchain, you can directly host your apps in just three steps to huggingface spaces where you can view and deploy your app to the world.
We support two types of deployment to huggingface spaces:
Using streamlit.io
Step 1: Create a new RAG app
Create a new RAG app using the following command:
mkdir my-rag-app
ec create --template=hf/streamlit.io # inside my-rag-app directory
When you run this for the first time, youโll be asked to login to huggingface.co. Once you login, youโll need to create a write token. You can create a write token by going to huggingface.co settings. Once you create a token, youโll be asked to enter the token in the terminal.
This will also create an embedchain.json
file in your app directory. Add a name
key into the embedchain.json
file. This will be the โrepo-nameโ of your app in huggingface spaces.
{
"name": "my-rag-app",
"provider": "hf/streamlit.io"
}
Step-2: Test app locally
You can run the app locally by simply doing:
pip install -r requirements.txt
ec dev
Step-3: Deploy to huggingface spaces
ec deploy
This will deploy your app to huggingface spaces. You can view your app at https://huggingface.co/spaces/<your-username>/my-rag-app
. This will get prompted in the terminal once the app is deployed.
Using gradio.app
Similar to streamlit.io, you can deploy your app to gradio.app in just three steps.
Step 1: Create a new RAG app
Create a new RAG app using the following command:
mkdir my-rag-app
ec create --template=hf/gradio.app # inside my-rag-app directory
When you run this for the first time, youโll be asked to login to huggingface.co. Once you login, youโll need to create a write token. You can create a write token by going to huggingface.co settings. Once you create a token, youโll be asked to enter the token in the terminal.
This will also create an embedchain.json
file in your app directory. Add a name
key into the embedchain.json
file. This will be the โrepo-nameโ of your app in huggingface spaces.
{
"name": "my-rag-app",
"provider": "hf/gradio.app"
}
Step-2: Test app locally
You can run the app locally by simply doing:
pip install -r requirements.txt
ec dev
Step-3: Deploy to huggingface spaces
ec deploy
This will deploy your app to huggingface spaces. You can view your app at https://huggingface.co/spaces/<your-username>/my-rag-app
. This will get prompted in the terminal once the app is deployed.
Seeking help?
If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
Was this page helpful?