A Step-by-Step Coding Information to Constructing a Gemini-Powered AI Startup Pitch Generator Utilizing LiteLLM Framework, Gradio, and FPDF in Google Colab with PDF Export Assist


On this tutorial, we constructed a strong and interactive AI utility that generates startup pitch concepts utilizing Google’s Gemini Professional mannequin by means of the versatile LiteLLM framework. LiteLLM is the spine of this implementation, offering a unified interface to work together with over 100 LLM suppliers utilizing OpenAI-compatible APIs, eliminating the complexity of coping with particular person SDKs. By leveraging LiteLLM, we seamlessly linked to Gemini’s capabilities for inventive ideation and wrapped the outputs right into a user-friendly Gradio interface. Additionally, we used FPDF to generate polished, Unicode-compatible PDFs containing the complete startup pitch deck. This tutorial demonstrates how trendy AI tooling, together with LiteLLM, Gradio, Google Generative AI, and FPDF, can construct an end-to-end resolution for entrepreneurs, innovators, and builders.

!pip set up litellm gradio fpdf --quiet

!pip set up litellm gradio fpdf –quiet installs the core libraries wanted for this venture. It brings in LiteLLM for interacting with Gemini by way of a unified API, Gradio for making a easy internet interface, and FPDF for exporting the AI-generated pitch right into a well-formatted PDF file—all whereas suppressing verbose set up logs with –quiet.

import os
import gradio as gr
import uuid
import urllib.request
from fpdf import FPDF
from litellm import completion


api_key = "Your API Key"

We import all of the important Python libraries used within the venture, together with os for file operations, uuid for producing distinctive filenames, and urllib for downloading fonts. We additionally initialize Gradio for the UI, FPDF for PDF creation, and LiteLLM’s completion perform to interface with Gemini. The api_key variable shops the consumer’s Gemini API key, which is required to authenticate requests.

import urllib.request
import zipfile
import os
import shutil


if not os.path.exists("DejaVuSans.ttf"):
    print("⏬ Downloading DejaVuSans.ttf...")
    font_zip_url = "https://downloads.sourceforge.web/venture/dejavu/dejavu/2.37/dejavu-fonts-ttf-2.37.zip"
    font_zip_path = "dejavu-fonts.zip"


    urllib.request.urlretrieve(font_zip_url, font_zip_path)


    with zipfile.ZipFile(font_zip_path, 'r') as zip_ref:
        zip_ref.extractall("dejavu-extracted")


    for root, dirs, recordsdata in os.stroll("dejavu-extracted"):
        for file in recordsdata:
            if file == "DejaVuSans.ttf":
                ttf_path = os.path.be part of(root, file)
                shutil.copy(ttf_path, "DejaVuSans.ttf")
                print("✅ Font extracted and prepared.")
                break

Right here, we make sure that the DejaVuSans.ttf font is on the market to create Unicode-compatible PDFs. It downloads the font zip file from SourceForge, extracts its contents, and copies the .ttf file to the working listing. This step is essential for dealing with particular characters from Gemini’s output when producing the ultimate pitch PDF utilizing FPDF.

def call_gemini(system_prompt, user_prompt):
    messages = [
        {"role": "system", "content": system_prompt},
        {"role": "user", "content": user_prompt}
    ]
    response = completion(
        mannequin="gemini/gemini-2.0-flash-lite",
        messages=messages,
        api_key=api_key
    )
    return response["choices"][0]["message"]["content"]

This perform, call_gemini, is a wrapper that makes use of LiteLLM’s completion API to work together with the Gemini 2.0 Flash Lite mannequin. It accepts a system immediate and a consumer immediate, buildings them in OpenAI-compatible format, sends the request utilizing the supplied API key, and returns the generated response—making it simple to reuse throughout numerous utility components.

def generate_startup_pitch(theme):
    attempt:
        idea_prompt = f"Generate an progressive startup thought within the subject of {theme}. Deal with fixing actual issues utilizing trendy expertise."
        tagline_prompt = "Primarily based on the concept you simply gave, generate a brief, catchy tagline for the startup."
        pitch_prompt = """
        Primarily based on the earlier startup thought, write a concise pitch deck protecting:
        1. Drawback
        2. Resolution
        3. Market Alternative
        4. Crew Description
        5. Enterprise Mannequin
        6. Traction or Future Plan
        Format it in a manner that appears like slide notes for a VC pitch.
        """


        thought = call_gemini("You're an innovation strategist.", idea_prompt)
        tagline = call_gemini("You're a branding knowledgeable.", tagline_prompt)
        pitch = call_gemini("You're a startup mentor writing a pitch deck.", pitch_prompt)


        filename = f"startup_pitch_{uuid.uuid4().hex[:8]}.pdf"
        pdf = FPDF()
        pdf.add_page()
        pdf.add_font("DejaVu", "", font_path, uni=True)
        pdf.set_font("DejaVu", dimension=12)


        full_text = f"Startup Concept:n{thought}nnTagline:n{tagline}nnPitch Deck:n{pitch}"
        pdf.multi_cell(0, 10, full_text)
        pdf.output(filename)


        return thought, tagline, pitch, filename
    besides Exception as e:
        return f"⚠️ Error: {e}", "", "", None

The generate_startup_pitch perform orchestrates all the startup era course of. It sends tailor-made prompts to Gemini by way of LiteLLM to provide a startup thought, a catchy tagline, and a structured pitch deck. The responses are then mixed right into a formatted PDF utilizing FPDF, with correct Unicode help by way of the DejaVu font. The PDF is saved with a novel filename, enabling customers to obtain their customized pitch. Error dealing with ensures clean execution and consumer suggestions in case of failures.

with gr.Blocks() as demo:
    gr.Markdown("# 🚀 AI Startup Pitch Generator (with PDF Export)")
    theme_input = gr.Textbox(label="Enter a theme or business", placeholder="e.g., psychological well being, fintech, local weather tech")


    generate_button = gr.Button("Generate Pitch")


    idea_output = gr.Textbox(label="Startup Concept")
    tagline_output = gr.Textbox(label="Tagline")
    pitch_output = gr.Textbox(label="Pitch Deck Abstract", traces=10)
    pdf_output = gr.File(label="Obtain Pitch as PDF")


    def wrapper(theme):
        thought, tagline, pitch, pdf_path = generate_startup_pitch(theme)
        return thought, tagline, pitch, pdf_path


    generate_button.click on(fn=wrapper, inputs=theme_input, outputs=[idea_output, tagline_output, pitch_output, pdf_output])


demo.launch(share=True)

We outlined the Gradio consumer interface for the AI Startup Pitch Generator. Utilizing gr.Blocks() creates a clear format with an enter field for the consumer to enter a startup theme or business and a button to set off the pitch era. As soon as clicked, the wrapper perform calls generate_startup_pitch, returning a startup thought, tagline, pitch abstract, and a downloadable PDF. The share=True flag permits public entry to the app, making it simple to demo or share the instrument with others by way of a novel URL.

App Interface to Generate Concepts

Obtain the PDF Report

In conclusion, by combining the abstraction energy of LiteLLM with the inventive intelligence of Google’s Gemini Professional, this tutorial highlights how builders can quickly prototype clever, production-ready purposes. LiteLLM drastically simplifies working with various LLM APIs by sustaining a constant OpenAI-style calling interface throughout suppliers like Gemini, Claude, OpenAI, and extra. By way of Gradio, we added an intuitive entrance finish to just accept consumer enter and show outcomes, whereas FPDF allowed us to transform AI-generated content material into shareable, well-formatted PDF paperwork. This tutorial showcases construct a multi-component AI app in a Colab-friendly surroundings and underlines LiteLLM’s position as a pivotal gateway to the increasing ecosystem of language fashions. Whether or not you’re constructing MVPs or manufacturing instruments, LiteLLM provides the pliability and scalability to maintain your LLM workflow quick and future-proof.


Right here is the Colab Notebook. Additionally, don’t neglect to observe us on Twitter and be part of our Telegram Channel and LinkedIn Group. Don’t Neglect to affix our 85k+ ML SubReddit.

🔥 [Register Now] miniCON Virtual Conference on OPEN SOURCE AI: FREE REGISTRATION + Certificate of Attendance + 3 Hour Short Event (April 12, 9 am- 12 pm PST) + Hands on Workshop [Sponsored]


Asif Razzaq is the CEO of Marktechpost Media Inc.. As a visionary entrepreneur and engineer, Asif is dedicated to harnessing the potential of Synthetic Intelligence for social good. His most up-to-date endeavor is the launch of an Synthetic Intelligence Media Platform, Marktechpost, which stands out for its in-depth protection of machine studying and deep studying information that’s each technically sound and simply comprehensible by a large viewers. The platform boasts of over 2 million month-to-month views, illustrating its recognition amongst audiences.

Leave a Reply

Your email address will not be published. Required fields are marked *