3laa2 commited on
Commit
0aa3d75
·
1 Parent(s): ac3819a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -23
app.py CHANGED
@@ -18,26 +18,27 @@ the_type = st.selectbox("Model Name",("stabilityai/stable-diffusion-2-1-base",
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)
 
 
18
  create = st.button("Create The Model")
19
 
20
  if create:
21
+ st.session_state.count.t2m_mod = create_model(loc=the_type)
22
+
23
+
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
+ model = st.session_state.count.t2m_mod
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)