tahirsher commited on
Commit
c2302e5
·
verified ·
1 Parent(s): 6aea10a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -4,14 +4,14 @@ from diffusers import DiffusionPipeline
4
  # Load the diffusion pipeline model
5
  @st.cache_resource
6
  def load_pipeline():
7
- # Use the 'SaiRaj03/Text_To_Image' model for fast generation
8
- pipe = DiffusionPipeline.from_pretrained("SaiRaj03/Text_To_Image")
9
  return pipe
10
 
11
  pipe = load_pipeline()
12
 
13
  # Streamlit app
14
- st.title("Text-to-Image Generation App (Fast)")
15
 
16
  # User input for prompt
17
  user_prompt = st.text_input("Enter your image prompt", value="Astronaut in a jungle, cold color palette, muted colors, detailed, 8k")
@@ -20,10 +20,10 @@ user_prompt = st.text_input("Enter your image prompt", value="Astronaut in a jun
20
  if st.button("Generate Image"):
21
  if user_prompt:
22
  with st.spinner("Generating image..."):
23
- # Generate the image using the new model
24
  image = pipe(user_prompt).images[0]
25
 
26
  # Display the generated image
27
- st.image(image, caption="Generated Image", use_column_width=True)
28
  else:
29
  st.error("Please enter a valid prompt.")
 
4
  # Load the diffusion pipeline model
5
  @st.cache_resource
6
  def load_pipeline():
7
+ # Using the 'black-forest-labs/FLUX.1-schnell' model for fast generation
8
+ pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell")
9
  return pipe
10
 
11
  pipe = load_pipeline()
12
 
13
  # Streamlit app
14
+ st.title("Text-to-Image Generation App (FLUX Model)")
15
 
16
  # User input for prompt
17
  user_prompt = st.text_input("Enter your image prompt", value="Astronaut in a jungle, cold color palette, muted colors, detailed, 8k")
 
20
  if st.button("Generate Image"):
21
  if user_prompt:
22
  with st.spinner("Generating image..."):
23
+ # Generate the image using the FLUX model
24
  image = pipe(user_prompt).images[0]
25
 
26
  # Display the generated image
27
+ st.image(image, caption="Generated Image (FLUX Model)", use_column_width=True)
28
  else:
29
  st.error("Please enter a valid prompt.")