File size: 876 Bytes
e00f00d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from utils.gemini_utils import model

def generate_meme_text(meme_description, topic):
    """Generate meme text based on the template description and topic."""
    prompt = f"""
    You are a meme generator AI. I will provide you with a description of a popular meme template. 
    Your task is to generate funny, clever, and relevant text to fill in the blank spaces of the meme. 
    The text should relate to {topic}. Make sure the text is concise and fits the meme format. 
    Here's the meme template description: {meme_description}
    Now, generate appropriate text for each part of the meme, keeping in mind the {topic}.
    Format your response as a list of text elements, each on a new line.
    """
    try:
        response = model.generate_content(prompt)
        return response.text
    except Exception as e:
        return f"Error generating meme text: {e}"