Update app.py
Browse files
app.py
CHANGED
@@ -11,14 +11,17 @@ def create_model(loc = "stabilityai/stable-diffusion-2-1-base", mch = 'cpu'):
|
|
11 |
pipe = pipe.to(mch)
|
12 |
return pipe
|
13 |
|
14 |
-
t2i = st.title("Text2Image
|
|
|
|
|
|
|
15 |
|
16 |
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 |
-
st.session_state.
|
22 |
|
23 |
|
24 |
prom = st.text_input("# Prompt",'')
|
@@ -39,6 +42,6 @@ with c5:
|
|
39 |
create = st.button("Imagine")
|
40 |
if create:
|
41 |
generator = torch.Generator("cpu").manual_seed(int(bu_1))
|
42 |
-
model = st.session_state.
|
43 |
img = model(prom, width=int(sl_1), height=int(sl_2), num_inference_steps=int(bu_2), generator=generator).images[0]
|
44 |
st.image(img)
|
|
|
11 |
pipe = pipe.to(mch)
|
12 |
return pipe
|
13 |
|
14 |
+
t2i = st.title("""# Text2Image
|
15 |
+
### CHECK "Create_Update_Model" :
|
16 |
+
- FIRST RUN OF THE CODE
|
17 |
+
- CHANGING MODEL""")
|
18 |
|
19 |
the_type = st.selectbox("Model Name",("stabilityai/stable-diffusion-2-1-base",
|
20 |
"CompVis/stable-diffusion-v1-4"))
|
21 |
create = st.button("Create The Model")
|
22 |
|
23 |
if create:
|
24 |
+
st.session_state.t2m_mod = create_model(loc=the_type)
|
25 |
|
26 |
|
27 |
prom = st.text_input("# Prompt",'')
|
|
|
42 |
create = st.button("Imagine")
|
43 |
if create:
|
44 |
generator = torch.Generator("cpu").manual_seed(int(bu_1))
|
45 |
+
model = st.session_state.t2m_mod
|
46 |
img = model(prom, width=int(sl_1), height=int(sl_2), num_inference_steps=int(bu_2), generator=generator).images[0]
|
47 |
st.image(img)
|