Spaces:
Sleeping
Sleeping
pratikshahp
commited on
Commit
•
1771de4
1
Parent(s):
90f95c0
Update app.py
Browse files
app.py
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
import streamlit as st
|
2 |
from PIL import Image
|
3 |
-
|
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 |
-
|
17 |
|
18 |
# Generate image from text prompt
|
19 |
-
generated_image =
|
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
|
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"):
|