Spaces:
Runtime error
Runtime error
| title: My Ai Twin | |
| emoji: 🤖 | |
| colorFrom: blue | |
| colorTo: indigo | |
| sdk: gradio | |
| sdk_version: 5.16.0 | |
| app_file: app.py | |
| pinned: false | |
| license: mit | |
| # AI Twin RAG Application | |
| This application is an AI Twin of yourself, built using Retrieval-Augmented Generation (RAG). It answers questions based on your personal data stored in the `knowledge_base/` directory. | |
| ## Features | |
| - **Personal Knowledge Base:** Uses your real and synthetic data to answer questions. | |
| - **RAG Pipeline:** Utilizes LangChain, ChromaDB, and Hugging Face embeddings for accurate retrieval. | |
| - **Interactive UI:** Built with Gradio for easy interaction. | |
| ## Setup & Installation | |
| 1. **Install Dependencies:** | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| 2. **Set Up Hugging Face Token:** | |
| - You need a Hugging Face API token to use the inference endpoint. | |
| - Set it as an environment variable: | |
| ```bash | |
| export HUGGINGFACEHUB_API_TOKEN="your_token_here" | |
| # Windows PowerShell: | |
| $env:HUGGINGFACEHUB_API_TOKEN="your_token_here" | |
| ``` | |
| - Or uncomment the line in `app.py` to set it directly. | |
| 3. **Run Verification (Optional):** | |
| ```bash | |
| python verify_rag.py | |
| ``` | |
| 4. **Launch the App:** | |
| ```bash | |
| python app.py | |
| ``` | |
| The app will run locally at `http://127.0.0.1:7860`. | |
| ## Deployment to Hugging Face Spaces | |
| 1. Create a new Space on [Hugging Face](https://huggingface.co/spaces). | |
| 2. Select **Gradio** as the SDK. | |
| 3. Upload the following files: | |
| - `app.py` | |
| - `requirements.txt` | |
| - `knowledge_base/` (entire folder) | |
| - `chroma_db/` (optional, can be generated on the fly, but better to let it generate) | |
| 4. Add your `HUGGINGFACEHUB_API_TOKEN` in the Space settings (Settings -> Variables and secrets). | |
| ## Files | |
| - `app.py`: Main application logic. | |
| - `knowledge_base/`: Directory containing your profile data. | |
| - `requirements.txt`: Python dependencies. | |
| - `verify_rag.py`: Script to test RAG logic without UI. | |