Isshi-AI-Twin / README.md
Isshi14's picture
Upload 3 files
4ed62bb verified

A newer version of the Gradio SDK is available: 6.14.0

Upgrade
metadata
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:

    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:
      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):

    python verify_rag.py
    
  4. Launch the App:

    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.
  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.