Skip to content

xrick/TeacherAssist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

71 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Teaching PPT Generator ๐ŸŽ“

A complete AI-powered presentation generation system that creates professional PowerPoint presentations from text content. Built with FastAPI backend, Presenton API for PPT generation, Ollama LLM for content analysis, and Pexels for image integration.

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Frontend  โ”‚โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚   Backend    โ”‚โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚  Presenton  โ”‚
โ”‚  (Browser)  โ”‚      โ”‚  Middleware  โ”‚      โ”‚     API     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                            โ”‚
                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
                      โ”‚            โ”‚
                 โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”
                 โ”‚ Ollama  โ”‚  โ”‚ Pexels โ”‚
                 โ”‚   LLM   โ”‚  โ”‚  API   โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“‹ Features

  • AI Content Analysis: Uses Ollama (qwen-oss:20) to analyze and structure content
  • Automatic Slide Generation: Creates 4-8 slides with proper structure
  • Image Integration: Automatically fetches relevant images from Pexels
  • Transcript Generation: Generate presentation scripts using Zephyr 7B model
  • Multiple Templates: Administrative, Educational, and General styles
  • Progress Tracking: Real-time generation progress updates
  • Export Options: Download as PowerPoint (PPTX), PDF, or transcript text
  • Modern UI: Responsive, professional interface in Traditional Chinese

๐Ÿš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • Python 3.9+
  • Ollama installed locally
  • Internet connection (for Pexels API)

Step 1: Install Ollama and Download Model

# Install Ollama (if not already installed)
curl https://ollama.ai/install.sh | sh

# Download the model
ollama pull qwen-oss:20

# Verify installation
ollama list

Step 2: Clone and Setup

# Create project directory
mkdir teaching-ppt-generator
cd teaching-ppt-generator

# Create directory structure
mkdir -p backend/app/{api,services,utils}
mkdir -p frontend
mkdir -p output

Step 3: Create Configuration Files

Copy all the provided files from the artifacts into their respective directories:

teaching-ppt-generator/
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ Dockerfile
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ””โ”€โ”€ app/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ main.py
โ”‚       โ”œโ”€โ”€ config.py
โ”‚       โ”œโ”€โ”€ models.py
โ”‚       โ”œโ”€โ”€ api/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ””โ”€โ”€ routes.py
โ”‚       โ””โ”€โ”€ services/
โ”‚           โ”œโ”€โ”€ __init__.py
โ”‚           โ”œโ”€โ”€ ollama_service.py
โ”‚           โ”œโ”€โ”€ pexels_service.py
โ”‚           โ”œโ”€โ”€ presenton_service.py
โ”‚           โ””โ”€โ”€ content_processor.py
โ””โ”€โ”€ frontend/
    โ””โ”€โ”€ index.html

Step 4: Start Services

# Build and start all services
docker-compose up -d

# Check logs
docker-compose logs -f

# Verify services are running
curl http://localhost:5000/api/health

Step 5: Open Frontend

Open frontend/index.html in your browser, or serve it with:

# Using Python
cd frontend
python3 -m http.server 8080

# Then visit: http://localhost:8080

๐Ÿ“š API Documentation

Once the backend is running, visit:

Main Endpoints

Method Endpoint Description
POST /api/generate Start presentation generation
GET /api/progress/{task_id} Check generation progress
GET /api/download/{id}/pptx Download PowerPoint file
GET /api/download/{id}/pdf Download PDF file
GET /api/health Health check

๐Ÿ”ง Configuration

Environment variables in .env:

# Presenton API
PRESENTON_API_KEY=sk-presenton-...
PRESENTON_API_URL=http://localhost:8000

# Ollama
OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=qwen-oss:20

# Pexels
PEXELS_API_KEY=your_key_here

# Backend
BACKEND_PORT=5000
CORS_ORIGINS=*

๐ŸŽจ Template Types

  1. Administrative (่กŒๆ”ฟ็ฐกๅ ฑ)

    • Professional, formal, structured style
    • Best for business reports, meetings
  2. Educational (ๆ•™ๅญธ็ฐกๅ ฑ)

    • Clear, teaching-oriented, easy to understand
    • Best for courses, tutorials, training
  3. General (ไธ€่ˆฌ็ฐกๅ ฑ)

    • Flexible, universal, visual style
    • Best for general presentations

๐Ÿ“– Usage Guide

  1. Input Content:

    • Minimum 50 characters required
    • Supports: meeting notes, course outlines, product intros, research, proposals
  2. Select Template:

    • Choose from 3 available templates
    • Each optimized for different use cases
  3. Generate:

    • Click "็”Ÿๆˆ็ฐกๅ ฑ" (Generate)
    • Wait 30-60 seconds for processing
    • Watch real-time progress updates
  4. Download:

    • Download as PowerPoint (.pptx)
    • Download as PDF (.pdf)
    • Generate and download presentation transcript (.txt)

๐ŸŽค Transcript Generation

The system uses Zephyr 7B model to generate professional presentation scripts:

Features

  • Three Speaking Styles:

    • Educational (ๆ•™ๅญธๅผ) - Clear, step-by-step explanations
    • Formal (ๆญฃๅผ) - Professional business language
    • Conversational (ๅฐ่ฉฑๅผ) - Easy, relatable style
  • Smart Duration Estimation: Calculates speaking time based on content

  • Slide-by-Slide Scripts: Individual scripts for each slide

  • Full Transcript: Complete presentation script with timing

Usage

  1. Generate a presentation first
  2. Click "็”Ÿๆˆๆผ”่ฌ›็จฟ" (Generate Transcript)
  3. Select speaking style
  4. Wait 30-60 seconds for generation
  5. Download as text file

Example Transcript Output

ใ€ๆŠ•ๅฝฑ็‰‡ 1: ไบบๅทฅๆ™บๆ…งๆ•™่‚ฒๆ‡‰็”จใ€‘
[้ ไผฐๆ™‚้–“: 45็ง’]
ๅ„ไฝ่€ๅธซใ€ๅŒๅญธๅ€‘ๅคงๅฎถๅฅฝ๏ผไปŠๅคฉๆˆ‘ๅ€‘่ฆไธ€่ตทๆŽข่จŽไธ€ๅ€‹ไปคไบบ่ˆˆๅฅฎ็š„ไธป้กŒ...

ใ€ๆŠ•ๅฝฑ็‰‡ 2: ๅญธ็ฟ’็›ฎๆจ™ใ€‘
[้ ไผฐๆ™‚้–“: 60็ง’]
ๅœจ้–‹ๅง‹ไน‹ๅ‰๏ผŒ่ฎ“ๆˆ‘ๅ€‘ๅ…ˆไบ†่งฃไปŠๅคฉ็š„ๅญธ็ฟ’็›ฎๆจ™ใ€‚้ฆ–ๅ…ˆ...

๐Ÿ” Troubleshooting

Ollama Connection Issues

# Check if Ollama is running
curl http://localhost:11434/api/tags

# Check available models
ollama list

# Pull missing models
ollama pull qwen-oss:20
ollama pull zephyr:7b

# Restart Ollama if needed
ollama serve

Presenton API Issues

# Check Presenton container logs
docker logs presenton-api

# Restart Presenton
docker-compose restart presenton

Backend Issues

# Check backend logs
docker-compose logs backend

# Rebuild backend
docker-compose up -d --build backend

๐Ÿ› ๏ธ Development

Run Backend Locally (without Docker)

cd backend

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

# Install dependencies
pip install -r requirements.txt

# Run server
uvicorn app.main:app --reload --host 0.0.0.0 --port 5000

Testing

# Test health endpoint
curl http://localhost:5000/api/health

# Test generation (replace content with your text)
curl -X POST http://localhost:5000/api/generate \
  -H "Content-Type: application/json" \
  -d '{
    "content": "้€™ๆ˜ฏไธ€ๅ€‹ๆธฌ่ฉฆๅ…งๅฎน๏ผŒ็”จๆ–ผ็”Ÿๆˆๆ•™ๅญธ็ฐกๅ ฑใ€‚ไธป่ฆ่จŽ่ซ–AIๆŠ€่ก“ๅœจๆ•™่‚ฒไธญ็š„ๆ‡‰็”จใ€‚ๅŒ…ๆ‹ฌๆฉŸๅ™จๅญธ็ฟ’ใ€ๆทฑๅบฆๅญธ็ฟ’็ญ‰ไธป้กŒใ€‚",
    "template": "educational",
    "language": "zh-TW"
  }'

๐Ÿ“ฆ Project Structure

teaching-ppt-generator/
โ”œโ”€โ”€ backend/                    # Backend API service
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ main.py            # FastAPI application
โ”‚   โ”‚   โ”œโ”€โ”€ config.py          # Configuration management
โ”‚   โ”‚   โ”œโ”€โ”€ models.py          # Pydantic models
โ”‚   โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ routes.py      # API endpoints
โ”‚   โ”‚   โ””โ”€โ”€ services/
โ”‚   โ”‚       โ”œโ”€โ”€ ollama_service.py       # LLM integration
โ”‚   โ”‚       โ”œโ”€โ”€ pexels_service.py       # Image search
โ”‚   โ”‚       โ”œโ”€โ”€ presenton_service.py    # PPT generation
โ”‚   โ”‚       โ””โ”€โ”€ content_processor.py    # Main orchestrator
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ””โ”€โ”€ Dockerfile
โ”œโ”€โ”€ frontend/                   # Frontend web interface
โ”‚   โ””โ”€โ”€ index.html             # Single-page application
โ”œโ”€โ”€ output/                     # Generated presentations
โ”œโ”€โ”€ docker-compose.yml         # Docker orchestration
โ”œโ”€โ”€ .env                       # Environment variables
โ””โ”€โ”€ README.md                  # This file

๐Ÿ” Security Notes

  • API Keys: Never commit .env file to version control
  • CORS: Set proper origins in production (not *)
  • Rate Limiting: Consider adding rate limiting for production
  • File Cleanup: Implement periodic cleanup of /output directory

๐Ÿš€ Deployment

Production Considerations

  1. Environment Variables

    # Use production URLs
    PRESENTON_API_URL=https://your-presenton-domain.com
    CORS_ORIGINS=https://your-frontend-domain.com
    DEBUG=False
  2. Reverse Proxy

    • Use nginx or Caddy in front of the backend
    • Enable HTTPS with Let's Encrypt
  3. Monitoring

    • Add logging service (e.g., ELK stack)
    • Monitor Ollama performance
    • Track API usage and costs
  4. Scaling

    • Use Redis for task queue
    • Add load balancer for multiple backend instances
    • Consider Kubernetes for orchestration

๐Ÿ“Š Performance

  • Average Generation Time: 30-60 seconds
  • Ollama Processing: 10-20 seconds
  • Presenton Generation: 15-30 seconds
  • Image Fetching: 5-10 seconds

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

๐Ÿ“ License

This project is licensed under the MIT License.

๐Ÿ™ Acknowledgments

  • Presenton: PPT generation engine
  • Ollama: Local LLM inference
  • Pexels: Free stock photos
  • FastAPI: Modern Python web framework

๐Ÿ“ž Support

For issues and questions:

  1. Check the Troubleshooting section
  2. Review API documentation at /docs
  3. Check Docker logs: docker-compose logs
  4. Verify Ollama status: ollama list

๐Ÿ”„ Updates

Version 1.0.0 (2025-01-XX)

  • Initial release
  • Support for 3 template types
  • Ollama integration (qwen-oss:20)
  • Pexels image integration
  • PPTX and PDF export

๐ŸŽฏ Roadmap

  • Add more template styles
  • Support for custom branding
  • Batch processing
  • User authentication
  • Presentation history
  • Custom image uploads
  • Multi-language support
  • Advanced editing features

Made with โค๏ธ for educators and presenters

About

An open-sourced txt2ppt project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors