Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,23 +8,22 @@
|
|
8 |
# if text:
|
9 |
# out = pipe(text)
|
10 |
# st.write(out)
|
|
|
11 |
import streamlit as st
|
12 |
-
from
|
13 |
-
from PIL import Image
|
14 |
-
import torch
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
19 |
|
20 |
-
|
|
|
21 |
|
|
|
22 |
if st.button('Generate Image'):
|
23 |
if text_input:
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
image = Image
|
29 |
|
30 |
-
st.image(image, caption='Generated Image', use_column_width=True) #display output
|
|
|
8 |
# if text:
|
9 |
# out = pipe(text)
|
10 |
# st.write(out)
|
11 |
+
|
12 |
import streamlit as st
|
13 |
+
from diffusers import DiffusionPipeline
|
|
|
|
|
14 |
|
15 |
+
# Load the stable-diffusion-2-1 model from diffusers
|
16 |
+
pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1")
|
|
|
17 |
|
18 |
+
# Get input text from the user
|
19 |
+
text_input = st.text_area('Enter some text')
|
20 |
|
21 |
+
# Add a submit button
|
22 |
if st.button('Generate Image'):
|
23 |
if text_input:
|
24 |
+
# Generate the image using the model
|
25 |
+
generated_image = pipeline(text_input)
|
26 |
+
|
27 |
+
# Display the generated image
|
28 |
+
st.image(generated_image, caption='Generated Image', use_column_width=True)
|
29 |
|
|