Update app.py
Browse files
app.py
CHANGED
@@ -17,9 +17,11 @@ the_type = st.selectbox("Model Name",("stabilityai/stable-diffusion-2-1-base",
|
|
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 |
-
|
23 |
|
24 |
prom = st.text_input("# Prompt",'')
|
25 |
|
@@ -39,5 +41,6 @@ with c5:
|
|
39 |
create = st.button("Imagine")
|
40 |
if create:
|
41 |
generator = torch.Generator("cpu").manual_seed(int(bu_1))
|
42 |
-
|
|
|
43 |
st.image(img)
|
|
|
17 |
"CompVis/stable-diffusion-v1-4"))
|
18 |
create = st.button("Create The Model")
|
19 |
|
20 |
+
session_state = SessionState.get(name='', mod=None)
|
21 |
+
|
22 |
if create:
|
23 |
t2m_mod = create_model(loc=the_type)
|
24 |
+
session_state.mod = t2m_mod
|
25 |
|
26 |
prom = st.text_input("# Prompt",'')
|
27 |
|
|
|
41 |
create = st.button("Imagine")
|
42 |
if create:
|
43 |
generator = torch.Generator("cpu").manual_seed(int(bu_1))
|
44 |
+
model = session_state.mod
|
45 |
+
img = model(prom, width=int(sl_1), height=int(sl_2), num_inference_steps=int(bu_2), generator=generator).images[0]
|
46 |
st.image(img)
|