{"id":24520420,"url":"https://github.com/deepset-ai/haystack-streamlit-app","last_synced_at":"2025-07-17T17:32:46.336Z","repository":{"id":272808564,"uuid":"917821895","full_name":"deepset-ai/haystack-streamlit-app","owner":"deepset-ai","description":"👾 A Template for Haystack Apps with Streamlit","archived":false,"fork":false,"pushed_at":"2025-01-17T15:12:07.000Z","size":67,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-20T15:49:58.657Z","etag":null,"topics":["demo","haystack-ai","streamlit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deepset-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-16T17:55:42.000Z","updated_at":"2025-02-16T13:22:01.000Z","dependencies_parsed_at":"2025-01-16T19:27:36.705Z","dependency_job_id":"f8597a38-8cb1-4455-ac0a-ebe350df6eeb","html_url":"https://github.com/deepset-ai/haystack-streamlit-app","commit_stats":null,"previous_names":["deepset-ai/haystack-streamlit-app"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/deepset-ai/haystack-streamlit-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepset-ai%2Fhaystack-streamlit-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepset-ai%2Fhaystack-streamlit-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepset-ai%2Fhaystack-streamlit-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepset-ai%2Fhaystack-streamlit-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepset-ai","download_url":"https://codeload.github.com/deepset-ai/haystack-streamlit-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepset-ai%2Fhaystack-streamlit-app/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265636857,"owners_count":23802574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demo","haystack-ai","streamlit"],"created_at":"2025-01-22T02:22:33.850Z","updated_at":"2025-07-17T17:32:46.318Z","avatar_url":"https://github.com/deepset-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: Haystack Application with Streamlit\nemoji: 👑\ncolorFrom: indigo\ncolorTo: indigo\nsdk: streamlit\nsdk_version: 1.41.1\napp_file: app.py\npinned: false\n---\n\n# Template for Haystack Apps with Streamlit\n\nThis template [Streamlit](https://docs.streamlit.io/) app is set up for simple [Haystack](https://haystack.deepset.ai/) applications. The template is ready to do **Retrievel Augmented Generation** on example files.\n\nSee the ['How to use this template'](#how-to-use-this-template) instructions below to create a simple UI for your own Haystack search pipelines.\n\nBelow you will also find instructions on how you could [push this to Hugging Face Spaces 🤗](#pushing-to-hugging-face-spaces-).\n\n## Installation and Running\nTo run the bare application:\n1. Install requirements: `pip install -r requirements.txt`\n2. Include all environment variable in a `.env` file\n  Example `.env`\n  ```\n  WEAVIATE_API_KEY=\"YOUR_KEY\"\n  MISTRAL_API_KEY=\"YOUR_KEY\" # this demo uses Mistral models by default\n  ```\n3. Decide on the files and the method to populate your database (Check out instructions in `haystack.py`)\n4. Run the streamlit app: `streamlit run app.py`\n\nThis will start up the app on `localhost:8501` where you will find a simple search bar. \n\n## How to use this template\n1. Create a new repository from this template or simply open it in a codespace to start playing around 💙\n2. Make sure your `requirements.txt` file includes the Haystack (`haystack-ai`) and Streamlit versions you would like to use.\n3. Change the code in `utils/haystack.py` if you would like a different pipeline. \n4. Create a `.env` file with all of your configuration settings.\n5. Make any UI edits if you'd like to.\n6. Run the app as show in [installation and running](#installation-and-running)\n\n### Repo structure\n- `./utils`: This is where we have 2 files: \n    - `haystack.py`: Here you will find some functions already set up for you to start creating your Haystack search pipeline. It includes 2 main functions called `start_haystack_pipeline()` which is what we use to create a pipeline and cache it, and `query()` which is the function called by `app.py` once a user query is received.\n    - `ui.py`: Use this file for any UI and initial value setups.\n- `app.py`: This is the main Streamlit application file that we will run. In its current state it has a sidebar, a simple search bar, a 'Run' button, and a response.\n- `./files`: You can use this folder to store files to be indexed.\n\n### What to edit?\nThere are default pipelines both in `start_document_store()` and `start_haystack_pipeline()`. Change the pipelines to use different document stores, embedding and generative models or update the pipelines as you need. Check out [📚 Useful Resources](#-useful-resources) section for details.\n\n### 📚 Useful Resources\n* [Get Started](https://haystack.deepset.ai/overview/quick-start)\n* [Docs](https://docs.haystack.deepset.ai/docs/intro)\n    * [Creating Custom Components](https://docs.haystack.deepset.ai/docs/custom-components)\n* [Tutorials](https://haystack.deepset.ai/tutorials)\n* [Integrations](https://haystack.deepset.ai/integrations)\n    * [Mistral](https://haystack.deepset.ai/integrations/mistral)\n    * [Weaviate](https://haystack.deepset.ai/integrations/weaviate-document-store)\n\n## Pushing to Hugging Face Spaces 🤗\n\nBelow is an example GitHub action that will let you push your Streamlit app straight to the Hugging Face Hub as a Space.\n\nA few things to pay attention to:\n\n1. Create a New Space on Hugging Face with the Streamlit SDK.\n2. Create a Hugging Face token on your HF account.\n3. Create a secret on your GitHub repo called `HF_TOKEN` and put your Hugging Face token here.\n4. If you're using DocumentStores or APIs that require some keys/tokens, make sure these are provided as a secret for your HF Space too!\n5. This readme is set up to tell HF spaces that it's using streamlit and that the app is running on `app.py`, make any changes to the frontmatter of this readme to display the title, emoji etc you desire.\n6. Create a file in `.github/workflows/hf_sync.yml`. Here's an example that you can change with your own information, and an [example workflow](https://github.com/TuanaCelik/should-i-follow/blob/main/.github/workflows/hf_sync.yml) working for the [Should I Follow demo](https://huggingface.co/spaces/deepset/should-i-follow)\n\n```yaml\nname: Sync to Hugging Face hub\non:\n  push:\n    branches: [main]\n\n  # to run this workflow manually from the Actions tab\n  workflow_dispatch:\n\njobs:\n  sync-to-hub:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n        with:\n          fetch-depth: 0\n          lfs: true\n      - name: Push to hub\n        env:\n          HF_TOKEN: ${{ secrets.HF_TOKEN }}\n        run: git push --force https://{YOUR_HF_USERNAME}:$HF_TOKEN@{YOUR_HF_SPACE_REPO} main\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepset-ai%2Fhaystack-streamlit-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepset-ai%2Fhaystack-streamlit-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepset-ai%2Fhaystack-streamlit-app/lists"}