Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ import cv2 as cv
|
|
3 |
import time
|
4 |
import torch
|
5 |
from diffusers import StableDiffusionPipeline
|
6 |
-
import SessionState
|
7 |
|
8 |
# "stabilityai/stable-diffusion-2-1-base"
|
9 |
# "CompVis/stable-diffusion-v1-4"
|
@@ -18,30 +17,27 @@ the_type = st.selectbox("Model Name",("stabilityai/stable-diffusion-2-1-base",
|
|
18 |
"CompVis/stable-diffusion-v1-4"))
|
19 |
create = st.button("Create The Model")
|
20 |
|
21 |
-
session_state = SessionState.get(name='', mod=None)
|
22 |
-
|
23 |
if create:
|
24 |
t2m_mod = create_model(loc=the_type)
|
25 |
-
|
26 |
-
|
27 |
-
prom = st.text_input("# Prompt",'')
|
28 |
-
|
29 |
-
c1,c2,c3 = st.columns([1,1,3])
|
30 |
-
c4,c5 = st.columns(2)
|
31 |
-
with c1:
|
32 |
-
|
33 |
-
with c2:
|
34 |
-
|
35 |
-
with c3:
|
36 |
-
|
37 |
-
with c4:
|
38 |
-
|
39 |
-
with c5:
|
40 |
-
|
41 |
-
|
42 |
-
create = st.button("Imagine")
|
43 |
-
if create:
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
st.image(img)
|
|
|
3 |
import time
|
4 |
import torch
|
5 |
from diffusers import StableDiffusionPipeline
|
|
|
6 |
|
7 |
# "stabilityai/stable-diffusion-2-1-base"
|
8 |
# "CompVis/stable-diffusion-v1-4"
|
|
|
17 |
"CompVis/stable-diffusion-v1-4"))
|
18 |
create = st.button("Create The Model")
|
19 |
|
|
|
|
|
20 |
if create:
|
21 |
t2m_mod = create_model(loc=the_type)
|
22 |
+
cont = True
|
23 |
+
with cont:
|
24 |
+
prom = st.text_input("# Prompt",'')
|
25 |
+
|
26 |
+
c1,c2,c3 = st.columns([1,1,3])
|
27 |
+
c4,c5 = st.columns(2)
|
28 |
+
with c1:
|
29 |
+
bu_1 = st.text_input("Seed",'999')
|
30 |
+
with c2:
|
31 |
+
bu_2 = st.text_input("Steps",'12')
|
32 |
+
with c3:
|
33 |
+
bu_3 = st.text_input("Number of Images",'1')
|
34 |
+
with c4:
|
35 |
+
sl_1 = st.slider("Width",256,1024,128)
|
36 |
+
with c5:
|
37 |
+
sl_2 = st.slider("hight",256,1024,128)
|
38 |
+
|
39 |
+
create = st.button("Imagine")
|
40 |
+
if create:
|
41 |
+
generator = torch.Generator("cpu").manual_seed(int(bu_1))
|
42 |
+
img = t2m_mod(prom, width=int(sl_1), height=int(sl_2), num_inference_steps=int(bu_2), generator=generator).images[0]
|
43 |
+
st.image(img)
|
|