Spaces:
Runtime error
Runtime error
HardWorkingStation
commited on
Commit
•
99748b4
1
Parent(s):
e7d464d
Initial commit
Browse files- .gitattributes +1 -0
- app.py +15 -12
- model/stable-diffusion.bin +3 -0
.gitattributes
CHANGED
@@ -29,3 +29,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
32 |
+
model/* filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
|
3 |
import streamlit as st
|
4 |
|
@@ -12,26 +13,28 @@ st.set_page_config(layout="wide")
|
|
12 |
st.title('Play with Stable-Diffusion v1-4')
|
13 |
|
14 |
model_id = "CompVis/stable-diffusion-v1-4"
|
15 |
-
|
16 |
auth_token = os.environ.get("StableDiffusion")
|
17 |
|
18 |
|
19 |
with st.spinner(
|
20 |
text='Loading...'
|
21 |
):
|
22 |
-
pipe = StableDiffusionPipeline.from_pretrained(
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
)
|
28 |
-
|
29 |
-
|
|
|
|
|
30 |
|
31 |
|
32 |
def infer(prompt, samples=2, steps=30, scale=7.5, seed=25):
|
33 |
-
|
34 |
-
generator = torch.Generator().manual_seed(seed)
|
35 |
|
36 |
with autocast("cuda"):
|
37 |
images_list = pipe(
|
@@ -62,7 +65,7 @@ with st.form(key='new'):
|
|
62 |
|
63 |
steps = col2.select_slider(
|
64 |
label='Steps',
|
65 |
-
options=range(1,
|
66 |
value=40
|
67 |
)
|
68 |
|
1 |
import os
|
2 |
+
import pickle
|
3 |
|
4 |
import streamlit as st
|
5 |
|
13 |
st.title('Play with Stable-Diffusion v1-4')
|
14 |
|
15 |
model_id = "CompVis/stable-diffusion-v1-4"
|
16 |
+
device = "cuda"
|
17 |
auth_token = os.environ.get("StableDiffusion")
|
18 |
|
19 |
|
20 |
with st.spinner(
|
21 |
text='Loading...'
|
22 |
):
|
23 |
+
# pipe = StableDiffusionPipeline.from_pretrained(
|
24 |
+
# model_id,
|
25 |
+
# revision="fp16",
|
26 |
+
# torch_dtype=torch.float16,
|
27 |
+
# use_auth_token=auth_token
|
28 |
+
# )
|
29 |
+
with open('model/stable-diffusion.bin', 'rb') as model_file:
|
30 |
+
pipe = pickle.load(model_file)
|
31 |
+
st.success('Model loaded. Start caching to GPU...')
|
32 |
+
pipe = pipe.to(device)
|
33 |
|
34 |
|
35 |
def infer(prompt, samples=2, steps=30, scale=7.5, seed=25):
|
36 |
+
generator = torch.Generator(device=device).manual_seed(seed)
|
37 |
+
# generator = torch.Generator().manual_seed(seed)
|
38 |
|
39 |
with autocast("cuda"):
|
40 |
images_list = pipe(
|
65 |
|
66 |
steps = col2.select_slider(
|
67 |
label='Steps',
|
68 |
+
options=range(1, 101),
|
69 |
value=40
|
70 |
)
|
71 |
|
model/stable-diffusion.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e6a135cedd2bafde17e9da2138845a83768f62cc0e01a16d29cf5388bc47a3b1
|
3 |
+
size 2743182527
|