pratikshahp commited on
Commit
1771de4
1 Parent(s): 90f95c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -1,30 +1,30 @@
1
  import streamlit as st
2
  from PIL import Image
3
- from diffusers import DiffusionPipeline
4
-
5
- choice = st.sidebar.selectbox("Enter Your Choice",["Home","DALL-E","Diffusers"])
6
- if choice == "Home":
7
- st.title("Text to Image Generation App!")
8
- elif choice == "DALL-E"
9
- st.subheader("Text to image generation with DALL-E")
10
- else:
11
- st.subheader("Text to image generation with Diffusers")
12
 
 
 
 
 
 
 
 
13
 
14
  def generate_image(prompt):
15
  # Load Diffusion pipeline
16
- pipeline = DiffusionPipeline.from_pretrained("fluently/Fluently-XL-v2")
17
 
18
  # Generate image from text prompt
19
- generated_image = pipeline(prompt)
20
 
21
  return generated_image
22
 
23
  # Set Streamlit app title
24
- st.title("Text to Image Generation")
25
 
26
  # Text input for prompt
27
- prompt = st.text_input("Enter your text prompt:", "")
28
 
29
  # Button to generate image
30
  if st.button("Generate Image"):
 
1
  import streamlit as st
2
  from PIL import Image
3
+ import torch
4
+ from diffusers import StableDiffusionPipeline
 
 
 
 
 
 
 
5
 
6
+ #choice = st.sidebar.selectbox("Enter Your Choice",["Home","DALL-E","Diffusers"])
7
+ #if choice == "Home":
8
+ st.title("Text to Image Generation App!")
9
+ #elif choice == "DALL-E"
10
+ # st.subheader("Text to image generation with DALL-E")
11
+ #else:
12
+ # st.subheader("Text to image generation with Diffusers")
13
 
14
  def generate_image(prompt):
15
  # Load Diffusion pipeline
16
+ pipe = StableDiffusionPipeline.from_pretrained("fluently/Fluently-XL-v2",torch_dtype=torch.float16)
17
 
18
  # Generate image from text prompt
19
+ generated_image = pipe(prompt).images[0]
20
 
21
  return generated_image
22
 
23
  # Set Streamlit app title
24
+ #st.title("Text to Image Generation")
25
 
26
  # Text input for prompt
27
+ prompt = st.text_input("Enter your image description:", "")
28
 
29
  # Button to generate image
30
  if st.button("Generate Image"):