title | app_file | sdk | sdk_version |
---|---|---|---|
AI_Script_Generator |
src/app.py |
gradio |
5.13.1 |
Transform transcripts and PDFs into timed, structured teaching scripts using AI
AI Script Generator is an advanced AI system that converts PDF transcripts, raw text, and conversational content into well-structured teaching scripts. It seamlessly processes inputs, extracting and analyzing the content to create organized, pedagogically sound scripts with time markers. Designed for educators, students, content creators, and anyone looking to transform information into clear explanations.
Try it out: AI Script Generator on Hugging Face Spaces
- 🤖 PDF transcript and raw text processing
- 🤖 AI-powered content transformation
- 📚 Structured teaching script generation
- 🔄 Coherent topic organization
- 🔌 Support for multiple AI providers (Gemini/OpenAI)
- ⏱️ Time-marked sections for pacing
- 🌐 Multilingual interface (English/Spanish) with flag selector
- 🌍 Generation in ANY language through the guiding prompt (not limited to UI languages)
The generated scripts follow a structured format:
- Each section includes time markers (e.g.,
[11:45]
) to help pace delivery - Customizable duration: From as short as 2 minutes to 60 minutes, with timing adjusted accordingly
- Introduction with learning objectives
- Time-marked content sections
- Examples and practical applications
- Interactive elements (questions, exercises)
- Recap and key takeaways
For example:
[00:00] Introduction to Topic
- Learning objectives
- Key concepts overview
[11:45] Main Concept Explanation
- Detailed explanation
- Practical example
- Student interaction point
[23:30] Advanced Applications
...
- Python 3.8 or higher
- Virtual environment (recommended)
- Gemini API key (or OpenAI API key)
# Clone the repository
git clone https://github.com/RogelioRichmanAstronaut/AI-Script-Generator.git
cd AI-Script-Generator
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set up environment variables (choose one API key based on your preference)
export GEMINI_API_KEY='your-gemini-api-key' # Primary option
# OR
export OPENAI_API_KEY='your-openai-api-key' # Alternative option
# On Windows use:
# set GEMINI_API_KEY=your-gemini-api-key
# set OPENAI_API_KEY=your-openai-api-key
# Run with Python path set
PYTHONPATH=$PYTHONPATH:. python src/app.py
# Access the web interface
# Open http://localhost:7860 in your browser
Our system uses a sophisticated multi-stage prompting approach:
-
Content Analysis & Chunking
- Smart text segmentation for handling large documents (9000+ words)
- Contextual overlap between chunks to maintain coherence
- Key topic and concept extraction from each segment
-
Structure Generation
- Time-based sectioning (customizable from 2-60 minutes)
- Educational flow design with clear progression
- Integration of pedagogical elements (examples, exercises, questions)
-
Educational Enhancement
- Transformation of casual content into formal teaching script
- Addition of practical examples and case studies
- Integration of interaction points and reflection questions
- Time markers for pacing guidance
-
Coherence Validation
- Cross-reference checking between sections
- Verification of topic flow and progression
- Consistency check for terminology and concepts
- Quality assessment of educational elements
-
Context Length Management
- Challenge: Handling documents beyond model context limits
- Solution: Implemented sliding window chunking with overlap
- Result: Successfully processes documents up to 9000+ words with extensibility for more
-
Educational Structure
- Challenge: Converting conversational text to teaching format
- Solution:
- Structured templating system for different time formats (2-60 min)
- Integration of pedagogical elements (examples, exercises)
- Time-based sectioning with clear progression
- Result: Coherent, time-marked teaching scripts with interactive elements
-
Content Coherence
- Challenge: Maintaining narrative flow across chunked content
- Solution:
- Contextual overlap between chunks
- Topic tracking across sections
- Cross-reference validation system
- Result: Seamless content flow with consistent terminology
-
Educational Quality
- Challenge: Ensuring high pedagogical value
- Solution:
- Integration of learning objectives
- Strategic placement of examples and exercises
- Addition of reflection questions
- Time-appropriate pacing markers
- Result: Engaging, structured learning materials
- PDF Processing: Extracts and cleans text from PDF transcripts
- Text Processing: Handles direct text input and cleans/structures it
- Content Analysis: Uses AI to understand and structure the content
- Script Generation: Transforms content into educational format
-
PDF/Text Handling
- Robust PDF text extraction
- Raw text input processing
- Clean-up of extracted content
-
AI Processing
- Integration with Gemini API (primary)
- OpenAI API support (alternative)
- Structured prompt system for consistent output
-
Output Generation
- Organized teaching scripts
- Clear section structure
- Learning points and key concepts
The system follows a modular design:
- 📄 PDF/text processing module
- 🔍 Text analysis component
- 🤖 AI integration layer
- 📝 Output formatting system
Contributions are what make the open source community amazing! Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
Distributed under the MIT License. See LICENSE
for more information.
- Thanks to all contributors who have helped shape AI Script Generator
- Special thanks to the Gemini and OpenAI teams for their amazing APIs
- Inspired by educators and communicators worldwide who make learning engaging
Project Link: https://github.com/RogelioRichmanAstronaut/AI-Script-Generator
- Support for multiple output formats (PDF, PPTX)
- Interactive elements generation
- Custom templating system
- Copy to clipboard button for generated content
- Multilingual capabilities
- Content generation in any language via guiding prompt
- UI language support
- English
- Spanish
- French
- German
- Integration with LMS platforms
- Timestamp toggle - ability to show/hide time markers in the output text
Made with ❤️ for educators, students, and communicators everywhere
# Testing GitHub Actions workflow