Spaces:
Sleeping
Sleeping
prakhar patidar
commited on
Commit
•
85c84bf
1
Parent(s):
7fa416f
try with image generation
Browse files- app.py +12 -11
- requirements.txt +3 -0
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
|
4 |
-
|
5 |
|
6 |
-
|
7 |
-
|
8 |
|
9 |
# pipe = pipe.to("cuda")
|
10 |
|
@@ -14,10 +14,11 @@ import streamlit as st
|
|
14 |
|
15 |
|
16 |
with st.form("tti_form"):
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
from diffusers import StableDiffusionPipeline
|
4 |
+
import torch
|
5 |
|
6 |
+
model_id = "runwayml/stable-diffusion-v1-5"
|
7 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
|
8 |
|
9 |
# pipe = pipe.to("cuda")
|
10 |
|
|
|
14 |
|
15 |
|
16 |
with st.form("tti_form"):
|
17 |
+
st.write("Text to Image")
|
18 |
+
prompt = st.text_input("Enter Prompt")
|
19 |
+
# Every form must have a submit button.
|
20 |
+
submitted = st.form_submit_button("Submit")
|
21 |
+
if submitted:
|
22 |
+
st.write("prompt", prompt)
|
23 |
+
image = pipe(prompt).images[0]
|
24 |
+
st.image(image)
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|
3 |
+
diffusers[torch]
|