Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,24 +16,23 @@ is_colab = utils.is_google_colab()
|
|
16 |
colab_instruction = "" if is_colab else """
|
17 |
<p>You can skip the queue using Colab: <a href="https://colab.research.google.com/gist/ChenWu98/0aa4fe7be80f6b45d3d055df9f14353a/copy-of-fine-tuned-diffusion-gradio.ipynb"><img data-canonical-src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" src="https://colab.research.google.com/assets/colab-badge.svg"></a></p>"""
|
18 |
|
19 |
-
if
|
20 |
-
|
21 |
-
if is_colab:
|
22 |
-
scheduler = DDIMScheduler.from_config(model_id_or_path, subfolder="scheduler")
|
23 |
-
pipe = CycleDiffusionPipeline.from_pretrained(model_id_or_path, scheduler=scheduler)
|
24 |
-
else:
|
25 |
-
import streamlit as st
|
26 |
-
scheduler = DDIMScheduler.from_config(model_id_or_path, use_auth_token=st.secrets["USER_TOKEN"], subfolder="scheduler")
|
27 |
-
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
28 |
-
pipe = CycleDiffusionPipeline.from_pretrained(model_id_or_path, use_auth_token=st.secrets["USER_TOKEN"], scheduler=scheduler, torch_dtype=torch_dtype)
|
29 |
-
tokenizer = pipe.tokenizer
|
30 |
-
|
31 |
-
if torch.cuda.is_available():
|
32 |
-
pipe = pipe.to("cuda")
|
33 |
-
|
34 |
device_print = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
|
35 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
class LocalBlend:
|
39 |
|
|
|
16 |
colab_instruction = "" if is_colab else """
|
17 |
<p>You can skip the queue using Colab: <a href="https://colab.research.google.com/gist/ChenWu98/0aa4fe7be80f6b45d3d055df9f14353a/copy-of-fine-tuned-diffusion-gradio.ipynb"><img data-canonical-src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" src="https://colab.research.google.com/assets/colab-badge.svg"></a></p>"""
|
18 |
|
19 |
+
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
20 |
+
model_id_or_path = "CompVis/stable-diffusion-v1-4"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
device_print = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
|
22 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
23 |
|
24 |
+
if is_colab:
|
25 |
+
scheduler = DDIMScheduler.from_config(model_id_or_path, subfolder="scheduler")
|
26 |
+
pipe = CycleDiffusionPipeline.from_pretrained(model_id_or_path, scheduler=scheduler, torch_dtype=torch_dtype)
|
27 |
+
else:
|
28 |
+
import streamlit as st
|
29 |
+
scheduler = DDIMScheduler.from_config(model_id_or_path, use_auth_token=st.secrets["USER_TOKEN"], subfolder="scheduler")
|
30 |
+
pipe = CycleDiffusionPipeline.from_pretrained(model_id_or_path, use_auth_token=st.secrets["USER_TOKEN"], scheduler=scheduler, torch_dtype=torch_dtype)
|
31 |
+
tokenizer = pipe.tokenizer
|
32 |
+
|
33 |
+
if torch.cuda.is_available():
|
34 |
+
pipe = pipe.to("cuda")
|
35 |
+
|
36 |
|
37 |
class LocalBlend:
|
38 |
|