memespace / utils /meme_utils.py
ombhojane's picture
Create utils/meme_utils.py
e00f00d verified
raw
history blame contribute delete
876 Bytes
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}"