https://github.com/deepset-ai/haystack-streamlit-app

👾 A Template for Haystack Apps with Streamlit

https://github.com/deepset-ai/haystack-streamlit-app

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • â—‹
    CITATION.cff file
  • ✓
    codemeta.json file
    Found codemeta.json file
  • ✓
    .zenodo.json file
    Found .zenodo.json file
  • â—‹
    DOI references
  • â—‹
    Academic publication links
  • â—‹
    Committers with academic emails
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (14.5%) to scientific vocabulary

Keywords

demo haystack-ai streamlit
Last synced: 4 months ago · JSON representation

Repository

👾 A Template for Haystack Apps with Streamlit

Basic Info
  • Host: GitHub
  • Owner: deepset-ai
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 65.4 KB
Statistics
  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
demo haystack-ai streamlit
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md


title: Haystack Application with Streamlit emoji: 👑 colorFrom: indigo colorTo: indigo sdk: streamlit sdkversion: 1.41.1 appfile: app.py

pinned: false

Template for Haystack Apps with Streamlit

This template Streamlit app is set up for simple Haystack applications. The template is ready to do Retrievel Augmented Generation on example files.

See the 'How to use this template' instructions below to create a simple UI for your own Haystack search pipelines.

Below you will also find instructions on how you could push this to Hugging Face Spaces 🤗.

Installation and Running

To run the bare application: 1. Install requirements: pip install -r requirements.txt 2. Include all environment variable in a .env file Example .env WEAVIATE_API_KEY="YOUR_KEY" MISTRAL_API_KEY="YOUR_KEY" # this demo uses Mistral models by default 3. Decide on the files and the method to populate your database (Check out instructions in haystack.py) 4. Run the streamlit app: streamlit run app.py

This will start up the app on localhost:8501 where you will find a simple search bar.

How to use this template

  1. Create a new repository from this template or simply open it in a codespace to start playing around 💙
  2. Make sure your requirements.txt file includes the Haystack (haystack-ai) and Streamlit versions you would like to use.
  3. Change the code in utils/haystack.py if you would like a different pipeline.
  4. Create a .env file with all of your configuration settings.
  5. Make any UI edits if you'd like to.
  6. Run the app as show in installation and running

Repo structure

  • ./utils: This is where we have 2 files:
    • 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.
    • ui.py: Use this file for any UI and initial value setups.
  • 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.
  • ./files: You can use this folder to store files to be indexed.

What to edit?

There 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 section for details.

📚 Useful Resources

Pushing to Hugging Face Spaces 🤗

Below is an example GitHub action that will let you push your Streamlit app straight to the Hugging Face Hub as a Space.

A few things to pay attention to:

  1. Create a New Space on Hugging Face with the Streamlit SDK.
  2. Create a Hugging Face token on your HF account.
  3. Create a secret on your GitHub repo called HF_TOKEN and put your Hugging Face token here.
  4. 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!
  5. 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.
  6. 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 working for the Should I Follow demo

```yaml name: Sync to Hugging Face hub on: push: branches: [main]

# to run this workflow manually from the Actions tab workflow_dispatch:

jobs: sync-to-hub: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: fetch-depth: 0 lfs: true - name: Push to hub env: HFTOKEN: ${{ secrets.HFTOKEN }} run: git push --force https://{YOURHFUSERNAME}:$HFTOKEN@{YOURHFSPACEREPO} main ```

Owner

  • Name: deepset
  • Login: deepset-ai
  • Kind: organization
  • Email: hello@deepset.ai
  • Location: Berlin, Germany

Building enterprise search systems powered by latest NLP & open-source.

GitHub Events

Total
  • Watch event: 5
  • Member event: 1
  • Push event: 4
  • Fork event: 1
  • Create event: 2
Last Year
  • Watch event: 5
  • Member event: 1
  • Push event: 4
  • Fork event: 1
  • Create event: 2

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 5
  • Total Committers: 1
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 5
  • Committers: 1
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
bilgeyucel b****6@g****m 5

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

requirements.txt pypi
  • datasets *
  • haystack-ai ==2.9.0
  • lmnt *
  • markdown-it-py *
  • mdit_plain *
  • mistral-haystack *
  • nltk *
  • pypdf *
  • python-dotenv *
  • sentence-transformers >=3.0.0
  • streamlit ==1.41.1
  • weaviate-haystack *