3laa2 commited on
Commit
24d77bb
·
1 Parent(s): 22c64f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -10,12 +10,15 @@ def create_model(loc = "stabilityai/stable-diffusion-2-1-base", mch = 'cpu'):
10
  pipe = StableDiffusionPipeline.from_pretrained(loc)
11
  pipe = pipe.to(mch)
12
  return pipe
13
-
14
  t2i = st.checkbox("Text2Image")
15
 
16
- if t2i:
 
 
 
17
  st.title("Text2Image")
18
- t2m_mod = create_model()
19
 
20
  prom = st.text_input("# Prompt",'')
21
 
@@ -34,6 +37,6 @@ if t2i:
34
 
35
  create = st.button("Imagine")
36
  if create:
37
- generator = torch.Generator("cuda").manual_seed(int(bu_1))
38
  img = t2m_mod(prom, width=int(sl_1), height=int(sl_2), num_inference_steps=int(bu_2), generator=generator).images[0]
39
  st.image(img)
 
10
  pipe = StableDiffusionPipeline.from_pretrained(loc)
11
  pipe = pipe.to(mch)
12
  return pipe
13
+
14
  t2i = st.checkbox("Text2Image")
15
 
16
+ type = st.selectbox("Model Name",("stabilityai/stable-diffusion-2-1-base", "CompVis/stable-diffusion-v1-4"))
17
+ create = st.checkbox("Create The Model")
18
+
19
+ if create:
20
  st.title("Text2Image")
21
+ t2m_mod = create_model(loc=type)
22
 
23
  prom = st.text_input("# Prompt",'')
24
 
 
37
 
38
  create = st.button("Imagine")
39
  if create:
40
+ generator = torch.Generator("cpu").manual_seed(int(bu_1))
41
  img = t2m_mod(prom, width=int(sl_1), height=int(sl_2), num_inference_steps=int(bu_2), generator=generator).images[0]
42
  st.image(img)