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
Clone the repository:
git clone <your-repo-url> cd backendCreate a Virtual Environment:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activateInstall Dependencies:
pip install -r requirements.txtRun 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.