BMClogo

In this tutorial, we build a powerful and interactive AI application that generates startup tone ideas through the Versatile Litellm Framework using Google’s Gemini Pro model. Litellm It is the backbone of this implementation, providing a unified interface to interact with more than 100 LLM providers using OpenAI-compatible APIs, eliminating the complexity of processing with a single SDK. By leveraging Litellm, we seamlessly connect to Gemini’s creative conceptual capabilities and package the output into a user-friendly Gradio interface. Additionally, we use FPDF to generate a polished, compatible PDF containing the full boot pitch deck. This tutorial demonstrates how modern AI tools including Litellm, Gradio, Google Generative AI, and FPDF can build end-to-end solutions for entrepreneurs, innovators, and developers.

!pip install litellm gradio fpdf --quiet

! It interacts with Gemini through a unified API for creating a simple web interface and exporting AI-generated tones to FPDF in a well-formed PDF file while suppressing the erotic installation log 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 the required Python libraries used in our project, including the OS for file operations, the UUID for generating unique file names, and the Urllib for downloading fonts. We also initialize gradio to UI, FPDF for PDF creation, and Litellm’s completion function interface with Gemini. The API_KEY variable stores the user’s Gemini API key, which is required to authenticate the request.

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.net/project/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, files in os.walk("dejavu-extracted"):
        for file in files:
            if file == "DejaVuSans.ttf":
                ttf_path = os.path.join(root, file)
                shutil.copy(ttf_path, "DejaVuSans.ttf")
                print("✅ Font extracted and ready.")
                break

Here we make sure that we can use the Dejavusans.ttf font to create Unicode-compatible PDFs. It downloads the font ZIP file from SourceForge, extracts its contents, and then copies the .TTF file to the working directory. This step is crucial for processing special characters from Gemini’s output when generating the final pitch PDF using FPDF.

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

This feature Call_gemini is a wrapper that uses Litellm’s full API to interact with the Gemini 2.0 Flash Lite model. It accepts system and user prompts, constructs them in a compartment-compatible format, sends requests using provided API keys, and returns generated responses – making it easy to reuse across various application parts.

def generate_startup_pitch(theme):
    try:
        idea_prompt = f"Generate an innovative startup idea in the field of {theme}. Focus on solving real problems using modern technology."
        tagline_prompt = "Based on the idea you just gave, generate a short, catchy tagline for the startup."
        pitch_prompt = """
        Based on the previous startup idea, write a concise pitch deck covering:
        1. Problem
        2. Solution
        3. Market Opportunity
        4. Team Description
        5. Business Model
        6. Traction or Future Plan
        Format it in a way that looks like slide notes for a VC pitch.
        """


        idea = call_gemini("You are an innovation strategist.", idea_prompt)
        tagline = call_gemini("You are a branding expert.", tagline_prompt)
        pitch = call_gemini("You are 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", size=12)


        full_text = f"Startup Idea:\n{idea}\n\nTagline:\n{tagline}\n\nPitch Deck:\n{pitch}"
        pdf.multi_cell(0, 10, full_text)
        pdf.output(filename)


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

The GENTATE_STARTUP_PITCH function coordinates the startup generation process. It sends tailored tips to Gemini via litellm to generate start-up ideas, engaging signs and structured pitch decks. Then, use FPDF to merge the response into a formatted PDF and provide appropriate Unicode support via DEJAVU fonts. PDF is saved with a unique file name, allowing users to download their personalized tones. Error handling ensures smooth execution and user feedback in the event of a failure.

with gr.Blocks() as demo:
    gr.Markdown("# 🚀 AI Startup Pitch Generator (with PDF Export)")
    theme_input = gr.Textbox(label="Enter a theme or industry", placeholder="e.g., mental health, fintech, climate tech")


    generate_button = gr.Button("Generate Pitch")


    idea_output = gr.Textbox(label="Startup Idea")
    tagline_output = gr.Textbox(label="Tagline")
    pitch_output = gr.Textbox(label="Pitch Deck Summary", lines=10)
    pdf_output = gr.File(label="Download Pitch as PDF")


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


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


demo.launch(share=True)

We define the Gradio user interface for AI launching tone generator. Use gr.blocks() to create a clean layout with an input box for the user to enter to start the topic or industry and a button to trigger tone generation. After clicking, the wrapper function calls generate_startup_pitch, returning the startup idea, slogan, pitch summary and downloadable PDF. The share = true flag enables the public to access the application, making it easy to share the tool with others through a unique URL.

Application interface generation idea

Download PDF Report

In short, by combining Litellm’s abstraction capabilities with Google’s creative intelligence, this tutorial highlights how developers can quickly prototypify intelligence that can produce ready applications. Litellm greatly simplifies collaboration with different LLM APIs by maintaining a consistent OpenAi style interface among providers such as Gemini, Claude, OpenAI, and more. With Gradio, we add an intuitive front-end to accept user input and display results, while FPDF allows us to convert AI-generated content into a shareable, good PDF document. This tutorial shows how to build multi-component AI applications in a Colab-friendly environment and highlights Litellm’s role as a key gateway to the language model extension ecosystem. Whether you are building MVPs or producing tools, Litellm provides flexibility and scalability to make LLM workflows fast and future.


This is COLAB notebook. Also, don’t forget to follow us twitter And join us Telegram Channel and LinkedIn GrOUP. Don’t forget to join us 85k+ ml reddit.

🔥 (Register now) Open Source AI’s Minicon Virtual Conference: Free Registration + Attendance Certificate + 3-hour Short Event (April 12, 9am to 12pm)


Asif Razzaq is CEO of Marktechpost Media Inc. As a visionary entrepreneur and engineer, ASIF is committed to harnessing the potential of artificial intelligence to achieve social benefits. His recent effort is to launch Marktechpost, an artificial intelligence media platform that has an in-depth coverage of machine learning and deep learning news that can sound both technically, both through technical voices and be understood by a wide audience. The platform has over 2 million views per month, demonstrating its popularity among its audience.

Source link