huggingface_spaces.mdx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ---
  2. title: 'Huggingface.co'
  3. description: 'Deploy your RAG application to huggingface.co platform'
  4. ---
  5. 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.
  6. We support two types of deployment to huggingface spaces:
  7. <CardGroup cols={2}>
  8. <Card title="" href="#using-streamlit-io">
  9. Streamlit.io
  10. </Card>
  11. <Card title="" href="#using-gradio-app">
  12. Gradio.app
  13. </Card>
  14. </CardGroup>
  15. ## Using streamlit.io
  16. ### Step 1: Create a new RAG app
  17. Create a new RAG app using the following command:
  18. ```bash
  19. mkdir my-rag-app
  20. ec create --template=hf/streamlit.io # inside my-rag-app directory
  21. ```
  22. 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](https://huggingface.co/settings/token). Once you create a token, you'll be asked to enter the token in the terminal.
  23. 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.
  24. ```json embedchain.json
  25. {
  26. "name": "my-rag-app",
  27. "provider": "hf/streamlit.io"
  28. }
  29. ```
  30. ### Step-2: Test app locally
  31. You can run the app locally by simply doing:
  32. ```bash Run locally
  33. pip install -r requirements.txt
  34. ec dev
  35. ```
  36. ### Step-3: Deploy to huggingface spaces
  37. ```bash Deploy to huggingface spaces
  38. ec deploy
  39. ```
  40. 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.
  41. ## Using gradio.app
  42. Similar to streamlit.io, you can deploy your app to gradio.app in just three steps.
  43. ### Step 1: Create a new RAG app
  44. Create a new RAG app using the following command:
  45. ```bash
  46. mkdir my-rag-app
  47. ec create --template=hf/gradio.app # inside my-rag-app directory
  48. ```
  49. 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](https://huggingface.co/settings/token). Once you create a token, you'll be asked to enter the token in the terminal.
  50. 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.
  51. ```json embedchain.json
  52. {
  53. "name": "my-rag-app",
  54. "provider": "hf/gradio.app"
  55. }
  56. ```
  57. ### Step-2: Test app locally
  58. You can run the app locally by simply doing:
  59. ```bash Run locally
  60. pip install -r requirements.txt
  61. ec dev
  62. ```
  63. ### Step-3: Deploy to huggingface spaces
  64. ```bash Deploy to huggingface spaces
  65. ec deploy
  66. ```
  67. 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.
  68. ## Seeking help?
  69. If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
  70. <Snippet file="get-help.mdx" />