diff --git a/docs/tutorial/generate-presentation-from-csv.mdx b/docs/tutorial/generate-presentation-from-csv.mdx index 20a0ea0c..4c0dd300 100644 --- a/docs/tutorial/generate-presentation-from-csv.mdx +++ b/docs/tutorial/generate-presentation-from-csv.mdx @@ -132,7 +132,7 @@ Each student will get a personalized presentation, and you’ll see the download ## 5. How It Works - The script reads each row from your CSV. -- It builds a detailed prompt for Presenton’s API (see [API Reference](./mdx.docs)). +- It builds a detailed prompt for Presenton’s API (see [API Reference](./generate-presentation-over-api)). - It sends a POST request to generate a presentation for each student. - The API returns a download path for each generated PPTX. - The presentation file is downloaded and saved in `presentations` folder. @@ -142,8 +142,8 @@ Each student will get a personalized presentation, and you’ll see the download ## 6. Next Steps - You can customize the prompt or number of slides as needed. -- For more on API options, see [Generate a PPT via API in 5 Minutes](./generate-ppt-via-api). -- For advanced configuration (e.g., using Ollama or GPU), see [Environment Variables](./configurations/environment-variables), [Using GPU](./configurations/using-gpu), and [Using Ollama Models](./configurations/using-ollama-models). +- For more on API options, see [Generate a PPT via API in 5 Minutes](./generate-presentation-over-api). +- For advanced configuration (e.g., using Ollama or GPU), see [Environment Variables](../configurations/environment-variables), [Using GPU](../configurations/using-gpu), and [Using Ollama Models](../configurations/using-ollama-models). Need help? See the [full documentation](./index) or open an issue on GitHub. diff --git a/docs/tutorial/generate-presentation-from-csv.mdx.mdx b/docs/tutorial/generate-presentation-from-csv.mdx.mdx deleted file mode 100644 index 20a0ea0c..00000000 --- a/docs/tutorial/generate-presentation-from-csv.mdx.mdx +++ /dev/null @@ -1,150 +0,0 @@ ---- -title: "Create Presentations from CSV using AI" -description: "Step-by-step guide to generating presentations from a CSV file" ---- - -In this tutorial, we will generate personalized student report presentations using self hosted Presenton's API and a Python script. - -This tutorial extends [Generate a PPT via API in 5 Minutes](./generate-presentation-over-api) and shows you how to automate the creation of personalized student report presentations from a CSV file using Python. - -So, do check it before continuing with this and make sure you have Presenton running locally or any server and you are able to generate presentations with it. - ---- - -## 1. Prepare Your CSV File - -Save your student data as `students.csv`: - -```csv -Name,Final Grade,ECA Participation,Sports Involvement,Quiz Scores,Class Behavior,Comment -Anaya Sharma,88,High,Moderate,92,Excellent,"Balanced performer with high curiosity" -Rohan Mehta,73,Low,None,75,Good,"Needs motivation beyond academics" -Meera Kapoor,94,Moderate,High,96,Excellent,"Academic excellence and team spirit" -Aarav Patel,62,None,None,58,Average,"Struggling across areas, needs focused help" -``` - ---- - -## 2. Install Python Requirements - -You’ll need the `requests` and `pandas` libraries: - -```bash -pip install requests pandas -``` - ---- - -## 3. Write the Python Script - -Let’s build the script step by step. - -### a. Import Libraries - -```python -import os -import pandas as pd -import requests -``` - -### b. Creat presentations directory - -```python -os.makedirs('presentations', exist_ok=True) -``` - -### c. Load the CSV - -```python -df = pd.read_csv("students.csv") -``` - -### d. Define a Function to Build the Prompt - -```python -def build_prompt(row): - return ( - f"Student Name: {row['Name']}\n" - f"Final Grade: {row['Final Grade']}\n" - f"ECA Participation: {row['ECA Participation']}\n" - f"Sports Involvement: {row['Sports Involvement']}\n" - f"Quiz Scores: {row['Quiz Scores']}\n" - f"Class Behavior: {row['Class Behavior']}\n" - f"Teacher's Comment: {row['Comment']}\n\n" - "Generate a parent-friendly presentation summarizing this student's academic and extracurricular performance, " - "highlighting strengths, areas for improvement, and any special notes from the teacher." - ) -``` - -### e. Loop Over Each Student and Generate a Presentation - -```python -for idx, row in df.iterrows(): - print(f"Generating presentation for {row['Name']}") - prompt = build_prompt(row) - data = { - "prompt": prompt, - "n_slides": "8", - "language": "English", - "theme": "light", - "export_as": "pdf" - } - response = requests.post( - "http://localhost:5000/api/v1/ppt/generate/presentation", - data=data - ) - if response.ok: - result = response.json() - print("Downloading presentation...") - # Prepend the host to the path - download_url = f"http://localhost:5000{result['path']}" - filename = f"presentations/{result['path'].split('/')[-1]}" - # Download and save the file - file_response = requests.get(download_url) - if file_response.ok: - with open(filename, 'wb') as f: - f.write(file_response.content) - print(f"Presentation for {row['Name']} saved as {filename}") - else: - print(f"Failed to download presentation for {row['Name']}: {file_response.status_code}") - else: - print(f"Failed to generate presentation for {row['Name']}: {response.text}") -``` - -Generated presentations will be saved in `presentations` directory. - -You may change the URL `http://localhost:5000` to the URL of your Presenton instance. - ---- - -## 4. Run the Script - -Save your script as `generate_reports.py` and run: - -```bash -python generate_reports.py -``` - -Each student will get a personalized presentation, and you’ll see the download path for each file in your terminal. - ---- - -## 5. How It Works - -- The script reads each row from your CSV. -- It builds a detailed prompt for Presenton’s API (see [API Reference](./mdx.docs)). -- It sends a POST request to generate a presentation for each student. -- The API returns a download path for each generated PPTX. -- The presentation file is downloaded and saved in `presentations` folder. - ---- - -## 6. Next Steps - -- You can customize the prompt or number of slides as needed. -- For more on API options, see [Generate a PPT via API in 5 Minutes](./generate-ppt-via-api). -- For advanced configuration (e.g., using Ollama or GPU), see [Environment Variables](./configurations/environment-variables), [Using GPU](./configurations/using-gpu), and [Using Ollama Models](./configurations/using-ollama-models). - - - Need help? See the [full documentation](./index) or open an issue on GitHub. - \ No newline at end of file diff --git a/docs/tutorial/generate-presentation-over-api.mdx b/docs/tutorial/generate-presentation-over-api.mdx index 46190286..d960c23b 100644 --- a/docs/tutorial/generate-presentation-over-api.mdx +++ b/docs/tutorial/generate-presentation-over-api.mdx @@ -5,7 +5,7 @@ description: "Steps to generate professional AI presentations via self hosted Pr In this guide, I'll walk you through a simple, straightforward way to host and use Presenton’s API for generating presentations. If you're a developer or someone building tools or automation around presentations, this approach will save you some valuable time. -Before we start, I'm assuming you've already set up Presenton. If not, just quickly check out the [Quickstart](./quickstart) or [Development guide](./development). +Before we start, I'm assuming you've already set up Presenton. If not, just quickly check out the [Quickstart](../quickstart) or [Development guide](../development). --- @@ -23,7 +23,7 @@ You're now ready to run Presenton's docker image to start generating presentatio We will go with `GOOGLE` in this guide as it's relatively simpler to configure and free to start with. You will have to grab its API Key from [Google AI Studio](https://aistudio.google.com/apikey). -You can find details to run with other providers in [Environment Variables](./environment-variables). +You can find details to run with other providers in [Environment Variables](../configurations/environment-variables). Now, open your command line and execute the relevant command based on your OS: @@ -67,7 +67,7 @@ Generating presentations via Presenton's API is straightforward. It has one prim POST /api/v1/ppt/generate/presentation ``` -For a deeper dive later, check the full [API documentation](./mdx.docs). +For a deeper dive later, check the full [API documentation](../index). --- @@ -133,12 +133,12 @@ Here's a quick reference for the key parameters you can set: | Parameter | Type | Required | Description | | ----------- | ------ | -------- | ---------------------------------------------------------- | -| `prompt` | string | 👍 Yes | Topic/title of your presentation | -| `n_slides` | int | ❌ No | Number of slides (default: 8; min: 5, max: 15) | -| `language` | string | ❌ No | Language you'd like the presentation in (default: English) | -| `theme` | string | ❌ No | Optional styling (e.g.: "light", "dark", "royal_blue") | -| `documents` | file[] | ❌ No | Additional supporting documents (PDF/PPTX/DOCX/TXT) | -| `export_as` | string | ❌ No | "pptx" or "pdf" (default: pptx) | +| `prompt` | string | Yes | Topic/title of your presentation | +| `n_slides` | int | No | Number of slides (default: 8; min: 5, max: 15) | +| `language` | string | No | Language you'd like the presentation in (default: English) | +| `theme` | string | No | Optional styling (e.g.: "light", "dark", "royal_blue") | +| `documents` | file[] | No | Additional supporting documents (PDF/PPTX/DOCX/TXT) | +| `export_as` | string | No | "pptx" or "pdf" (default: pptx) | Yes, it can generate presentations directly from most popular file formats. Make sure you understand the context window of model you're using with respect to file size. @@ -184,12 +184,12 @@ Presenton provides easy-to-use themes for quick styling: Once you're comfortable and ready for more: -- Integrate your preferred LLMS: [Environment Variables](./configurations/environment-variables). -- Leverage GPU performance: [GPU Guide](./configurations/using-gpu). -- Run local AI models with Ollama: [Local Models](./configurations/using-ollama-models). +- Integrate your preferred LLMS: [Environment Variables](../configurations/environment-variables). +- Leverage GPU performance: [GPU Guide](../configurations/using-gpu). +- Run local AI models with Ollama: [Local Models](../configurations/using-ollama-models). --- **That's it\!** You've successfully generated a professional-looking presentation through an easy-to-use API endpoint. -If you have more questions or want to explore further, the [complete documentation](./index) is always here to help you. \ No newline at end of file +If you have more questions or want to explore further, the [complete documentation](../index) is always here to help you. \ No newline at end of file