|
1 |
| -# Weaviate recipe |
| 1 | +# How to run the demo app |
| 2 | +This is a recipe for a movie recommendation app. The app uses [Weaviate](https://weaviate.io/) to create a vector database of movie titles and [Streamlit](https://streamlit.io/) to create a recommendation chatbot. |
| 3 | + |
| 4 | +Other ways to explore this recipe: |
| 5 | +* [Deployed app](https://weaviate-movie-magic.streamlit.app/) |
| 6 | +* [Video](https://youtu.be/SQD-aWlhqvM?si=t54W53G1gWnTAiwx) |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | +* Python >=3.8, !=3.9.7 |
| 10 | +* [A Weaviate API key and URL](https://auth.wcs.api.weaviate.io/auth/realms/SeMI/login-actions/registration?client_id=wcs-frontend&tab_id=5bw6GQTdWU0) |
| 11 | +* [A Cohere API key](https://dashboard.cohere.com/welcome/register) |
| 12 | + |
| 13 | +## Environment setup |
| 14 | +### Local setup |
| 15 | + |
| 16 | +#### Create a virtual environment |
| 17 | +1. Clone the Cookbook repo: `git clone https://github.com/streamlit/cookbook.git` |
| 18 | +2. From the Cookbook root directory, change directory into the recipe: `cd recipes/weaviate` |
| 19 | +3. Add secrets to the `.streamlit/secrets_template.toml` file |
| 20 | +4. Update the filename from `secrets_template.toml` to `secrets.toml`: `mv .streamlit/secrets_template.toml .streamlit/secrets.toml` |
| 21 | + |
| 22 | + (To learn more about secrets handling in Streamlit, refer to the documentation [here](https://docs.streamlit.io/develop/concepts/connections/secrets-management).) |
| 23 | +5. Create a virtual environment: `python3 -m venv weaviatevenv` |
| 24 | +6. Activate the virtual environment: `source weaviatevenv/bin/activate` |
| 25 | +7. Install the dependencies: `pip install -r requirements.txt` |
| 26 | + |
| 27 | +#### Add data to your Weaviate Cloud |
| 28 | +1. Create a Weaviate Cloud [Collection](https://weaviate.io/developers/weaviate/config-refs/schema#introduction) and add data to it: `python3 helpers/add_data.py` |
| 29 | +2. (Optional) Verify the data: `python3 helpers/verify_data.py` |
| 30 | +3. (Optional) Use the Weaviate Cloud UI to [query the Collection](https://weaviate.io/developers/weaviate/connections/connect-query#example-query): |
| 31 | + ``` |
| 32 | + { Get {MovieDemo (limit: 3 |
| 33 | + where: { path: ["release_year"], |
| 34 | + operator: Equal, |
| 35 | + valueInt: 1985}) { |
| 36 | + budget |
| 37 | + movie_id |
| 38 | + overview |
| 39 | + release_year |
| 40 | + revenue |
| 41 | + tagline |
| 42 | + title |
| 43 | + vote_average |
| 44 | + vote_count |
| 45 | + }}} |
| 46 | + ``` |
| 47 | +
|
| 48 | + #### Run the app |
| 49 | + 1. Run the app with: `streamlit run demo_app.py` |
| 50 | + 2. The app should spin up in a new browser tab |
| 51 | + |
| 52 | + (Please note that this version of the demo app does not feature the poster images so it will look different from the [deployed app](https://weaviate-movie-magic.streamlit.app/).) |
0 commit comments