Spaces:
Running
Running
test
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
import numpy as np
|
|
|
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
from utils import utils, tools, preprocess
|
| 6 |
|
|
@@ -12,6 +13,7 @@ CONTROLNET_FILENAME = "ControlAny-SDXL/anime_canny/controlnet.safetensors"
|
|
| 12 |
CACHE_DIR = None
|
| 13 |
|
| 14 |
|
|
|
|
| 15 |
def ui():
|
| 16 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 17 |
model_file = hf_hub_download(
|
|
@@ -39,7 +41,7 @@ def ui():
|
|
| 39 |
device=device,
|
| 40 |
hf_cache_dir=CACHE_DIR,
|
| 41 |
use_safetensors=True,
|
| 42 |
-
enable_xformers_memory_efficient_attention=
|
| 43 |
)
|
| 44 |
|
| 45 |
preprocessors = ['canny']
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
import numpy as np
|
| 4 |
+
import spaces
|
| 5 |
from huggingface_hub import hf_hub_download
|
| 6 |
from utils import utils, tools, preprocess
|
| 7 |
|
|
|
|
| 13 |
CACHE_DIR = None
|
| 14 |
|
| 15 |
|
| 16 |
+
@spaces.GPU
|
| 17 |
def ui():
|
| 18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 19 |
model_file = hf_hub_download(
|
|
|
|
| 41 |
device=device,
|
| 42 |
hf_cache_dir=CACHE_DIR,
|
| 43 |
use_safetensors=True,
|
| 44 |
+
enable_xformers_memory_efficient_attention=True,
|
| 45 |
)
|
| 46 |
|
| 47 |
preprocessors = ['canny']
|