Spaces:
Running
on
Zero
Running
on
Zero
Update style_transfer.py
Browse files- style_transfer.py +5 -1
style_transfer.py
CHANGED
|
@@ -8,6 +8,9 @@ import os
|
|
| 8 |
import base64
|
| 9 |
from io import BytesIO
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
class DogStyleTransfer:
|
| 12 |
"""
|
| 13 |
Class for handling dog image style transfer using Stable Diffusion.
|
|
@@ -124,7 +127,8 @@ class DogStyleTransfer:
|
|
| 124 |
model_id,
|
| 125 |
cache_dir=self.model_cache_dir,
|
| 126 |
torch_dtype=torch.float16 if self.device == "cuda" else torch.float32,
|
| 127 |
-
safety_checker=None # Remove safety checker to improve speed
|
|
|
|
| 128 |
)
|
| 129 |
|
| 130 |
if self.device == "cuda":
|
|
|
|
| 8 |
import base64
|
| 9 |
from io import BytesIO
|
| 10 |
|
| 11 |
+
os.environ['TORCH_ENABLE_MPS_FALLBACK'] = '1'
|
| 12 |
+
os.environ['PYTHONWARNINGS'] = 'ignore::DeprecationWarning,ignore::UserWarning'
|
| 13 |
+
|
| 14 |
class DogStyleTransfer:
|
| 15 |
"""
|
| 16 |
Class for handling dog image style transfer using Stable Diffusion.
|
|
|
|
| 127 |
model_id,
|
| 128 |
cache_dir=self.model_cache_dir,
|
| 129 |
torch_dtype=torch.float16 if self.device == "cuda" else torch.float32,
|
| 130 |
+
safety_checker=None, # Remove safety checker to improve speed
|
| 131 |
+
revision="main"
|
| 132 |
)
|
| 133 |
|
| 134 |
if self.device == "cuda":
|