File size: 3,682 Bytes
986db0b
 
 
 
 
 
 
 
 
 
f023f85
be9948b
986db0b
 
 
 
c239d5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
license: mit
title: AI_tutor
sdk: gradio
emoji: πŸ“š
colorFrom: red
colorTo: yellow
pinned: true
app_file: main.py
short_description: AI Tutor tool transforms documents or queries into lectures
sdk_version: 5.33.1
tag: "agent-demo-track"
---
title: AI tutor
sdk: gradio
app_file: main.py
pinned: false



# AI Tutor Application

## Overview
The AI Tutor Application is an advanced tool designed to transform documents (e.g., PDFs) or user queries into interactive and structured lectures. Equipped with cutting-edge AI capabilities, this application provides voice narration, retrieval-augmented generation (RAG) chatbot functionality, and PDF generation for educational purposes.

## Features

### 1. **Lecture Generation**
- Converts PDF content or user-provided queries into structured lectures.
- Generates detailed outlines, sections, and content tailored to the user's learning objectives.
- Supports multiple styles (e.g., academic, casual) and includes examples if requested.

### 2. **Voice Narration**
- Synthesizes lecture content into audio using text-to-speech (TTS) technology.
- Offers multiple voice options to suit user preferences.

### 3. **RAG Chatbot**
- Provides a chatbot powered by Retrieval-Augmented Generation (RAG) to answer questions based on lecture or PDF content.
- Maintains session memory for personalized interactions.

### 4. **PDF Processing**
- Extracts and processes text from PDF files.
- Supports metadata extraction and text cleaning for better analysis.

### 5. **Interactive Gradio Interface**
- User-friendly interface for uploading documents, generating lectures, and interacting with the chatbot.
- Allows users to download generated lectures as PDFs or audio files.

### 6. **Customizable Learning Objectives**
- Users can specify learning objectives to tailor the lecture content.
- AI analyzes objectives to create relevant and engaging content.

## How It Works
1. **Input**: Upload a PDF document or provide a query/learning objective.
2. **Processing**: The application analyzes the input, generates a structured lecture, and optionally synthesizes audio.
3. **Output**: Download the lecture as a PDF or listen to the audio narration.

## Installation
1. Clone the repository:
   ```bash
   git clone <repository-url>
   ```
2. Navigate to the project directory:
   ```bash
   cd PDFLectureMaster
   ```
3. Install dependencies:
   ```bash
   pip install -r requirements.txt
   ```

## Usage
1. Start the Gradio interface:
   ```bash
   python main.py
   ```
2. Open the provided URL in your browser.
3. Upload a PDF or enter a query to generate a lecture.

## Project Structure
- `main.py`: Entry point for the Gradio application.
- `app/`: Contains the core modules for lecture generation, chatbot, PDF processing, and more.
  - `lecture_generator.py`: Handles lecture creation.
  - `voice_synthesizer.py`: Converts text to speech.
  - `rag_system.py`: Implements the RAG chatbot.
  - `pdf_processor.py`: Extracts and processes PDF content.
  - `gradio_interface.py`: Defines the Gradio interface.

## Requirements
- Python 3.11 or higher
- OpenAI API key (set in `.env` file)

## Environment Variables
Create a `.env` file in the project root and add the following:
```env
OPENAI_API_KEY=<your_openai_api_key>
```

## License
This project is licensed under the MIT License. See the LICENSE file for details.

## Acknowledgments
- [OpenAI](https://openai.com/) for GPT-based models.
- [Gradio](https://gradio.app/) for the interactive interface.
- [ReportLab](https://www.reportlab.com/) for PDF generation.

---

*This project was developed to make learning more interactive and accessible by leveraging AI technologies.*