Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@ import gradio as gr
|
|
| 3 |
import torch
|
| 4 |
from PIL import Image
|
| 5 |
import utils
|
| 6 |
-
import streamlit as st
|
| 7 |
import ptp_utils
|
| 8 |
import seq_aligner
|
| 9 |
import torch.nn.functional as nnf
|
|
@@ -16,18 +15,18 @@ MAX_NUM_WORDS = 77
|
|
| 16 |
is_colab = utils.is_google_colab()
|
| 17 |
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
scheduler = DDIMScheduler.from_config(model_id_or_path,
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
|
| 32 |
device_print = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
|
| 33 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 3 |
import torch
|
| 4 |
from PIL import Image
|
| 5 |
import utils
|
|
|
|
| 6 |
import ptp_utils
|
| 7 |
import seq_aligner
|
| 8 |
import torch.nn.functional as nnf
|
|
|
|
| 15 |
is_colab = utils.is_google_colab()
|
| 16 |
|
| 17 |
|
| 18 |
+
model_id_or_path = "CompVis/stable-diffusion-v1-4"
|
| 19 |
+
if is_colab:
|
| 20 |
+
scheduler = DDIMScheduler.from_config(model_id_or_path, subfolder="scheduler")
|
| 21 |
+
pipe = CycleDiffusionPipeline.from_pretrained(model_id_or_path, scheduler=scheduler)
|
| 22 |
+
else:
|
| 23 |
+
import streamlit as st
|
| 24 |
+
scheduler = DDIMScheduler.from_config(model_id_or_path, use_auth_token=st.secrets["USER_TOKEN"], subfolder="scheduler")
|
| 25 |
+
pipe = CycleDiffusionPipeline.from_pretrained(model_id_or_path, use_auth_token=st.secrets["USER_TOKEN"], scheduler=scheduler)
|
| 26 |
+
tokenizer = pipe.tokenizer
|
| 27 |
|
| 28 |
+
if torch.cuda.is_available():
|
| 29 |
+
pipe = pipe.to("cuda")
|
| 30 |
|
| 31 |
device_print = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
|
| 32 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|