CoolFace
Apppublic

HarikaSeshaMani/vocab_arena

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
App README

๐Ÿค– AI Teaching Assistant

An intelligent, adaptive teaching assistant powered by Groq LLaMA, Sentence Transformers, and the YouTube Data API. It supports CAT, IPMAT, and CLAT aspirants by analyzing student queries, detecting intent and difficulty level, generating personalized explanations, and building a custom learning path with real video resources.


๐Ÿ—‚๏ธ Project Structure

project-root/
โ”œโ”€โ”€ main.py                        # FastAPI entry point
โ”œโ”€โ”€ app.py                         # Streamlit frontend
โ”œโ”€โ”€ .env                           # Environment variables (not committed)
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”œโ”€โ”€ health.py              # Health check endpoint
โ”‚   โ”‚   โ”œโ”€โ”€ query.py               # /analyze-query and /full-analysis endpoints
โ”‚   โ”‚   โ””โ”€โ”€ learning_path.py      # /learning-path endpoint
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ””โ”€โ”€ config.py             # Pydantic settings / .env loader
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ””โ”€โ”€ schemas.py            # All Pydantic data models
โ”‚   โ””โ”€โ”€ services/
โ”‚       โ”œโ”€โ”€ nlp_service.py        # Intent + difficulty detection via MiniLM + Groq
โ”‚       โ””โ”€โ”€ learning_path_service.py  # Explanation + path generation + YouTube

โš™๏ธ Prerequisites


๐Ÿš€ Setup Instructions

1. Clone the Repository

bash
git clone https://github.com/harikakota04/student-assist
cd student-assist

2. Create and Activate a Virtual Environment

bash
# macOS / Linux
python -m venv venv
source venv/bin/activate

# Windows
python -m venv venv
venv\Scripts\activate

3. Install Dependencies

bash
pip install -r requirements.txt

Your requirements.txt should include:

fastapi
uvicorn
pydantic-settings
groq
sentence-transformers
httpx
streamlit
requests

4. Configure Environment Variables

Create a .env file in the project root:

env
GROQ_API_KEY=your_groq_api_key_here
YOUTUBE_API_KEY=your_youtube_api_key_here   # optional
LLM_MODEL=llama-3.3-70b-versatile
MODEL_NAME=all-MiniLM-L6-v2
โš ๏ธ Never commit your .env file. Add it to .gitignore.

โ–ถ๏ธ Running the Application

You need two terminals open at the same time.

Terminal 1 โ€” Start the FastAPI Backend

bash
uvicorn app.main:app --reload --port 8000

Confirm it's running by visiting: http://localhost:8000/docs

You should see the Swagger UI with all available endpoints.

Terminal 2 โ€” Start the Streamlit Frontend

bash
streamlit run app.py

The app will open automatically in your browser at http://localhost:8501.


๐Ÿ”Œ API Endpoints

MethodEndpointDescription
GET/api/healthHealth check
POST/api/analyze-queryAnalyze a student query (NLP only)
POST/api/full-analysisFull pipeline: NLP + learning path + YouTube
POST/api/learning-pathGenerate learning path from structured request

Example Request โ€” /api/full-analysis

bash
curl -X POST http://localhost:8000/api/full-analysis \
  -H "Content-Type: application/json" \
  -d '{
    "query": "I am confused about backpropagation",
    "student_id": "student_001",
    "previous_topics": ["Neural Networks", "Gradient Descent"]
  }'

๐Ÿง  Intent Types Detected

IntentExample Query
๐Ÿ’ก Explanation"What is backpropagation?"
๐Ÿ” Example"Give me an example of a transformer"
โ“ Doubt Clarification"I'm confused about L1 vs L2 regularization"
๐Ÿ“– Revision"Revise key points of gradient descent"

๐Ÿ› Troubleshooting

"Cannot connect to backend" Make sure FastAPI is running on port 8000 before clicking the button in Streamlit.

"model_decommissioned" error Update LLM_MODEL in your .env file to llama-3.3-70b-versatile and restart the backend.

No YouTube videos showing Add a valid YOUTUBE_API_KEY to your .env. Without it, fallback search links are shown instead.

Slow first load The all-MiniLM-L6-v2 model is downloaded on first use (~90MB). Subsequent starts are fast.


๐Ÿ“„ License

This project was built as part of the ThinkPlus AI/ML Engineer Assignment.