An open API service indexing awesome lists of open source software.

https://github.com/adrijadastidar/vta-python

This is the Flask-based backend for the Virtual Teaching Assistant platform
https://github.com/adrijadastidar/vta-python

cors ffmpeg flask langchain llama3 noisereduce pdfplumber pydub python scipy waitress whisper-ai

Last synced: 2 days ago
JSON representation

This is the Flask-based backend for the Virtual Teaching Assistant platform

Awesome Lists containing this project

README

        

# ๐Ÿง  Virtual Teaching Assistant โ€“ Server (Flask Backend)

This is the **Flask-based backend** for the **Virtual Teaching Assistant** platform, a smart educational system that uses AI to transcribe lectures, generate summaries, create quizzes, and parse learning materials.

---

## ๐Ÿš€ Features

- ๐ŸŽค **Audio Upload & Transcription** โ€“ Accept `.wav` files and transcribe using OpenAI Whisper
- ๐Ÿงพ **AI-Powered Summarization** โ€“ Summarize transcripts using LLMs (LLaMA 3 via Groq API)
- ๐Ÿงช **Quiz Generation** โ€“ Extract questions from lecture content with retry logic
- ๐Ÿ“‚ **PDF Parsing** โ€“ Extract text from uploaded PDFs using `pdfplumber`
- ๐Ÿ”— **RESTful API** โ€“ Clean endpoints for frontend interaction
- ๐ŸŒ **Cross-Origin Support** โ€“ Enabled via `Flask-CORS`
- ๐Ÿ” **Environment-based Config** โ€“ Secure API keys via `.env`

---

## ๐Ÿ› ๏ธ Tech Stack

| Category | Tech/Library |
|---------------------|---------------------------------------|
| ๐Ÿ–ฅ๏ธ Server Framework | `Flask`, `waitress` (production WSGI) |
| ๐ŸŽถ Audio Processing | `ffmpeg`, `whisper`, `pydub`, `noisereduce`, `soundfile`, `scipy` |
| ๐Ÿ’ฌ LLM Integration | `langchain`, `langchain_groq`, `langchain_experimental`, `llama3` |
| ๐Ÿ“ NLP Utilities | Custom prompt chaining via `langchain` |
| ๐Ÿ“„ File Parsing | `pdfplumber` for PDF content extraction |
| ๐Ÿ” Environment Mgmt | `python-dotenv` |
| ๐ŸŒ CORS Handling | `Flask-CORS` |

---

## ๐Ÿ”ง Setup Instructions

### โœ… Prerequisites

* Python 3.9+
* FFmpeg installed (for audio preprocessing)
* `.env` file with your Groq API key

### ๐Ÿงช Installation

```bash
# Clone and enter project
cd server-python

# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt
```

### ๐Ÿ“„ .env Example

```
GROQ_API_KEY=your_groq_api_key_here
```

---

## โ–ถ๏ธ Running the Server

```bash
python app.py
```

Runs at: [http://localhost:5000](http://localhost:5000)

---

## ๐ŸŒ API Endpoints

| Method | Endpoint | Description |
| ------- | ---------------- | ---------------------------------------------- |
| ๐Ÿ“ค POST | `/getTranscript` | Upload `.wav` file and generate summary + quiz |
| ๐Ÿ“ POST | `/summary` | Generate summary JSON from transcript |
| ๐Ÿงช POST | `/quiz` | Generate quiz JSON from transcript |
| ๐Ÿ“„ POST | `/pdf` | Extract raw text from uploaded PDF file |

---

## ๐Ÿงช Testing & Debugging

* Use Swagger alternatives like [Postman](https://www.postman.com/) to test endpoints.
* Debug statements included in logs for API calls to internal services.

---

## ๐Ÿ›ก๏ธ Production Deployment

You can deploy using:

* `waitress` (already integrated)
* Docker (optional Dockerfile)
* Render, Heroku, or any Linux server with Python 3.9+

Example production run:

```bash
waitress-serve --host 0.0.0.0 --port 5000 app:app
```

---

## ๐Ÿค Contributing

We welcome all contributors! You can:

* ๐Ÿ” File bugs
* ๐ŸŒฑ Suggest improvements
* ๐Ÿ“ฆ Submit pull requests

---

### ๐Ÿ‘ฉโ€๐Ÿซ Let's build better classrooms with AI โ€” one lecture at a time! ๐Ÿš€