A newer version of the Streamlit SDK is available:
1.43.2
title: EnlightenQalb
emoji: π
colorFrom: gray
colorTo: red
sdk: streamlit
sdk_version: 1.41.1
app_file: app.py
pinned: false
license: mit
build:
- pip install -r requirements.txt
- bash build.sh
EnlightenQalb π
Overview
EnlightenQalb (Alchemy of Happiness) is a Streamlit-based application designed to help users explore philosophical and spiritual texts through advanced text retrieval models. The app uses two modelsβMPNet and OpenAI embeddingsβto search for relevant sections from a dataset, compare results, and gather user feedback on which result they find more helpful or accurate.
Features
- User Authentication: Users can log in using a set of credentials (environment-based).
- Dual Model Search: Uses two different models (all-mpnet-base-v2 and text-embedding-3-small) to search the dataset and compare results.
- Search Results Comparison: Displays search results side by side and allows users to rate the relevance of each result with emojis (π, π€·, π).
- Reactions Saving: User ratings for search results are saved into a dataset to improve the search functionality.
- Optimized Performance: Uses caching for both model and data loading to speed up performance and minimize unnecessary processing.
Installation
Clone the Repository:
git clone <repo-url> cd <repo-directory>
Install Dependencies: Install required dependencies using
pip
:pip install -r requirements.txt
Build the Project:
bash build.sh
Set Environment Variables: Ensure the following environment variables are set:
login_1
tologin_50
: Store usernames for authentication.password_1
topassword_50
: Store corresponding passwords.al_ghazali_rag_retrieval_evaluation
: Hugging Face API token for the project.
Usage
Run the Application:
streamlit run app.py
Authentication:
- After launching the app, users must log in by entering their username and password from the available credentials list.
Search for Text:
- Enter a query into the provided text input and click Search.
- The system will display two results: one from the MPNet model and one from the OpenAI model.
Rate Results:
- For each result, rate its relevance using the emojis: π, π€·, or π.
Save Reactions:
- After reviewing both results, click the Save Reactions button to store feedback and contribute to the dataset.
Technologies Used
- Streamlit: Framework for building the web application.
- Sentence Transformers (MPNet): Used for generating sentence embeddings and text similarity search.
- OpenAI API: Utilized for generating embeddings using OpenAI's models.
- Pandas: For data manipulation and handling of the dataset.
- Hugging Face Datasets: For accessing and saving dataset entries.
License
This project is licensed under the MIT License.
Notes
- The
frontend/build
folder should contain the React component for displaying search results. Ensure this component is properly built and included before running the app. - The Hugging Face API token is essential for performing searches using the OpenAI model. Ensure that the token is correctly set in the environment variables.
Contact
For any issues or suggestions, feel free to reach out via email.
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference