Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
| 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("
|
| 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)
|