Edu-AI / README.md
Orbit Automations
Auto-sync from Julius-606/Orbit monorepo
be6ee20
metadata
title: Edu-AI Backend
emoji: πŸŽ“
colorFrom: blue
colorTo: indigo
sdk: docker
app_file: main.py
pinned: false

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

=======

c230b89d102cae6b52dc586eb3f313b093b6d894

πŸŽ“ Edu-AI Backend

Welcome to the Edu-AI Prop Firm Backend, a robust and scalable API powered by FastAPI and Google Gemini AI. This backend serves as the core intelligence engine for the Edu-AI mobile application, handling everything from AI-driven mentorship to dynamic quiz generation.

πŸš€ Live on Hugging Face

<<<<<<< HEAD This backend is hosted on Hugging Face Spaces using Docker, providing a global endpoint for the mobile app while maintaining a stateful connection to a cloud database.

This backend is designed to be hosted on Hugging Face Spaces using Docker, providing a global endpoint for the mobile app while maintaining a stateful connection to a cloud database.

c230b89d102cae6b52dc586eb3f313b093b6d894


βš™οΈ Tech Stack

  • Framework: FastAPI (Python 3.10+)
  • AI Engine: Google Gemini (Generative AI) with intelligent key rotation.
  • Database: PostgreSQL (Cloud-hosted via Neon.tech) with local SQLite fallback.
  • ORM: SQLAlchemy 2.0
  • Deployment: Docker on Hugging Face Spaces.

✨ Key Features

  • AI Socratic Mentor: Context-aware chat system that adopts specific educational personas.
  • Dynamic Quiz Engine: Generates personalized multiple-choice quizzes based on the student's level and active units.
  • Performance Analytics: Tracks student "PnL" (Performance & Learning) and provides strategic recommendations.
  • Unit Management: Allows students to organize their curriculum and focus areas.
  • Fault Tolerance: Built-in Gemini API key rotation to handle rate limits and quotas automatically.

πŸ› οΈ Environment Variables

<<<<<<< HEAD To run this project, you must configure the following secrets/environment variables in your Space settings:

To run this project, you must configure the following secrets/environment variables:

c230b89d102cae6b52dc586eb3f313b093b6d894

Variable Description
DATABASE_URL Neon.tech PostgreSQL connection string.
GEMINI_API_KEY_1 Primary Google Gemini API Key.
GEMINI_API_KEY_2 Secondary Key (for rotation/failover).
GEMINI_API_KEY_N Additional keys as needed.

πŸ—οΈ Local Setup

  1. Clone the repository:

    git clone <your-repo-url>
    cd backend
    
  2. Create a Virtual Environment:

    python -m venv venv
    source venv/bin/activate  # Windows: venv\Scripts\activate
    
  3. Install Dependencies:

    pip install -r requirements.txt
    
  4. Run the Server:

    uvicorn main:app --reload
    

πŸ“Š Database Migration

To sync your local SQLite data to the cloud (Neon.tech):

python migrate_data.py

πŸ“‘ API Endpoints (Snapshot)

  • GET /: Health check.
  • GET /api/user/{user_id}/dashboard: Fetch comprehensive student stats.
  • POST /api/ai/chat: Interact with the AI Mentor.
  • POST /api/ai/quiz: Generate a new assessment.
  • POST /api/quiz/record: Save quiz performance to history.

<<<<<<< HEAD

πŸ›‘οΈ Robots & Security

  • GET /robots.txt: Configured to prevent unauthorized crawling of API endpoints.
  • CORS: Pre-configured for cross-origin requests from the Edu-AI mobile app.

c230b89d102cae6b52dc586eb3f313b093b6d894 Built with ❀️ for the next generation of learners.