File size: 1,424 Bytes
6a88f43
5467807
 
 
9217d81
5467807
ccabf38
6a88f43
5467807
 
265fed7
5467807
 
265fed7
5467807
 
 
 
 
 
 
 
26b4d63
5467807
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import streamlit as st
import torch
from diffusers import DiffusionPipeline
from PIL import Image

# Load the pre-trained model and LoRA weights
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")

# Streamlit app
st.title("Memeify")

# Input field for the meme prompt
prompt = st.text_area("Enter your meme prompt:", "meme, A medium-sized painting of a white T-rex in the middle of a dark, stormy night. The t-rex is facing towards the left side of the frame, its head turned towards the right. Its mouth is open, revealing its sharp teeth. A rooster is standing in the foreground of the painting, with a red cap on its head. The roosters head is turned to the right, and the word \"Remember who you are\" is written in white text above it. The background is a deep blue, with dark gray clouds and a crescent moon in the upper left corner of the image. There are mountains in the background, and a few other animals can be seen in the lower right corner.")

# Button to generate the meme
if st.button("Generate Meme"):
    with st.spinner("Generating meme..."):
        # Generate the image using the provided prompt
        image = pipe(prompt).images[0]
        
        # Convert the image to PIL format
        pil_image = Image.fromarray(image.astype('uint8'))
        
        # Display the generated image
        st.image(pil_image, caption="Generated Meme", use_column_width=True)