File size: 965 Bytes
8893107
6aea10a
8893107
6aea10a
8893107
6aea10a
 
 
 
8893107
6aea10a
8893107
 
6aea10a
8893107
 
6aea10a
8893107
 
 
 
 
6aea10a
 
8893107
 
 
 
 
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
27
28
29
30
import streamlit as st
from diffusers import DiffusionPipeline

# Load the diffusion pipeline model
@st.cache_resource
def load_pipeline():
    # Use the 'SaiRaj03/Text_To_Image' model for fast generation
    pipe = DiffusionPipeline.from_pretrained("SaiRaj03/Text_To_Image")
    return pipe

pipe = load_pipeline()

# Streamlit app
st.title("Text-to-Image Generation App (Fast)")

# User input for prompt
user_prompt = st.text_input("Enter your image prompt", value="Astronaut in a jungle, cold color palette, muted colors, detailed, 8k")

# Button to generate the image
if st.button("Generate Image"):
    if user_prompt:
        with st.spinner("Generating image..."):
            # Generate the image using the new model
            image = pipe(user_prompt).images[0]
            
            # Display the generated image
            st.image(image, caption="Generated Image", use_column_width=True)
    else:
        st.error("Please enter a valid prompt.")