Skip to content

Ianhl/Tricore-AI

Repository files navigation

🎓 Study-Pilot

Study-Pilot is an AI-powered study assistant that explains concepts in different personalities (modes), generates flashcards, and optionally converts explanations into audio.
Built for fast learning, engagement, and experimentation with AI personalities.


✨ Features

  • 🧠 AI Study Assistant

    • Clear, beginner-friendly explanations
    • Step-by-step reasoning
  • 🎭 Multiple Personality Modes

    • study-buddy
    • mr-broke
    • captain-quizhook
    • gym-bro
    • detective-chalk
    • sleep-deprived-grad
    • customer-support
    • unpaid-intern
  • 🔊 Text-to-Speech (Optional)

    • Converts AI responses into audio via a private Hugging Face TTS Space
    • Audio served statically via FastAPI
  • 🧾 Conversation Memory

    • PostgreSQL-backed storage
    • Persistent conversations and modes
  • 🗂️ Flashcard Generation

    • Generate summaries and flashcards from conversations
  • 🌐 Frontend

    • React + Vite + TailwindCSS

🏗️ Project Structure

study-pilot/
│
├── backend/
│   ├── main.py              # FastAPI app
│   ├── main_ai.py           # AI-only testing entry
│   ├── llm_utils.py         # Prompt building, modes, TTS logic
│   ├── prompts.py           # System + mode prompts
│   ├── database.py          # DB connection
│   ├── database_models.py   # SQLAlchemy models
│   ├── models.py            # Pydantic schemas
│   └── init.py              # DB initialization
│
├── frontend/
│   ├── index.html
│   ├── src/
│   ├── package.json
│   └── vite.config.js
│
└── README.md

⚙️ Tech Stack

Backend

  • FastAPI
  • OpenAI API (gpt-4o-mini)
  • PostgreSQL
  • SQLAlchemy
  • Hugging Face Spaces (TTS via Gradio Client)

Frontend

  • React
  • Vite
  • TailwindCSS

🚀 Getting Started

1️⃣ Clone the repository

git clone <your-repo-url>
cd study-pilot

2️⃣ Backend Setup

Install dependencies

pip install fastapi uvicorn sqlalchemy psycopg2 openai gradio-client

Configure Database

Update database.py with your PostgreSQL credentials:

db_url = "postgresql://USER:PASSWORD@localhost:5432/FastAPI"

Create DB tables

python init.py

3️⃣ OpenAI API Key

Set your OpenAI key (recommended via environment variable):

export OPENAI_API_KEY="your-key-here"

⚠️ Do NOT hardcode API keys in production.


4️⃣ Run Backend

uvicorn main:app --reload

Backend:

http://localhost:8000

5️⃣ Frontend Setup

cd frontend
npm install
npm run dev

Frontend:

http://localhost:5173

🔊 Text-to-Speech (Optional)

  • Uses a private Hugging Face Space
  • Audio generated via gradio_client
  • Saved to:
    static/audio/
    
  • Served at:
    /static/audio/<filename>.wav
    

⚠️ Depends on GPU availability and Space uptime.


🎭 Modes Explained

Mode Description
study-buddy Friendly and patient
mr-broke Dramatic, money metaphors
captain-quizhook Pirate-themed
gym-bro High-energy motivation
detective-chalk Noir detective
sleep-deprived-grad Chaotic but smart
customer-support Calm and professional
unpaid-intern Bitter but competent

Modes influence prompt style, temperature, and penalties.


🧪 Example API Call

POST /study

{
  "user_text": "What is RAM?",
  "mode": "gym-bro"
}

Response

{
  "response": "RAM is like your brain during a workout...",
  "audio_file_path": "/static/audio/example.wav"
}

🛠️ Known Limitations

  • Hugging Face GPU quotas
  • Cold-start latency
  • Audio length may truncate based on model behavior

📌 Future Improvements

  • Streaming audio
  • More voices
  • Auth + user profiles
  • Docker deployment

🏁 Built For

  • Hackathons
  • Learning tools
  • AI experimentation
  • Educational demos

🧠 Final Note

If it teaches you and makes you laugh — it’s working.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •