Spaces:
Runtime error
Runtime error
HardWorkingStation
commited on
Commit
•
f1b29bc
1
Parent(s):
c1e6de1
Initial commit
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
import torch
|
@@ -11,6 +13,8 @@ st.title('Play with Stable-Diffusion v1-4')
|
|
11 |
|
12 |
model_id = "CompVis/stable-diffusion-v1-4"
|
13 |
device = "cuda"
|
|
|
|
|
14 |
|
15 |
with st.spinner(
|
16 |
text='Loading...'
|
@@ -39,7 +43,6 @@ def infer(prompt, samples=2, steps=30, scale=7.5, seed=25):
|
|
39 |
images = []
|
40 |
for image in images_list["sample"]:
|
41 |
images.append(image)
|
42 |
-
|
43 |
return images
|
44 |
|
45 |
|
@@ -49,25 +52,24 @@ with st.form(key='new'):
|
|
49 |
|
50 |
col1, col2, col3 = st.columns(3)
|
51 |
|
52 |
-
with
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
)
|
71 |
|
72 |
st.form_submit_button()
|
73 |
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
import streamlit as st
|
4 |
|
5 |
import torch
|
|
|
13 |
|
14 |
model_id = "CompVis/stable-diffusion-v1-4"
|
15 |
device = "cuda"
|
16 |
+
auth_token = os.environ.get("StableDiffusion") or True
|
17 |
+
|
18 |
|
19 |
with st.spinner(
|
20 |
text='Loading...'
|
|
|
43 |
images = []
|
44 |
for image in images_list["sample"]:
|
45 |
images.append(image)
|
|
|
46 |
return images
|
47 |
|
48 |
|
|
|
52 |
|
53 |
col1, col2, col3 = st.columns(3)
|
54 |
|
55 |
+
with st.expander(label='Expand parameters'):
|
56 |
+
n_samples = col1.select_slider(
|
57 |
+
label='Num images',
|
58 |
+
options=range(1, 5),
|
59 |
+
value=1
|
60 |
+
)
|
61 |
+
|
62 |
+
steps = col2.select_slider(
|
63 |
+
label='Steps',
|
64 |
+
options=range(1, 61),
|
65 |
+
value=40
|
66 |
+
)
|
67 |
+
|
68 |
+
scale = col3.select_slider(
|
69 |
+
label='Guidance Scale',
|
70 |
+
options=range(1, 21),
|
71 |
+
value=7
|
72 |
+
)
|
|
|
73 |
|
74 |
st.form_submit_button()
|
75 |
|