Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
2bd18a2
1
Parent(s):
953a099
app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ from utils.utils import load_cn_model, load_cn_config, load_tagger_model, load_l
|
|
| 10 |
from utils.prompt_analysis import PromptAnalysis
|
| 11 |
|
| 12 |
|
| 13 |
-
def load_model():
|
| 14 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 15 |
dtype = torch.float16
|
| 16 |
model = "cagliostrolab/animagine-xl-3.1"
|
|
@@ -74,7 +74,7 @@ class Img2Img:
|
|
| 74 |
|
| 75 |
@spaces.GPU
|
| 76 |
def predict(self, input_image_path, prompt, negative_prompt, controlnet_scale):
|
| 77 |
-
pipe = load_model()
|
| 78 |
input_image_pil = Image.open(input_image_path)
|
| 79 |
base_size = input_image_pil.size
|
| 80 |
resize_image = resize_image_aspect_ratio(input_image_pil)
|
|
|
|
| 10 |
from utils.prompt_analysis import PromptAnalysis
|
| 11 |
|
| 12 |
|
| 13 |
+
def load_model(lora_dir, cn_dir):
|
| 14 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 15 |
dtype = torch.float16
|
| 16 |
model = "cagliostrolab/animagine-xl-3.1"
|
|
|
|
| 74 |
|
| 75 |
@spaces.GPU
|
| 76 |
def predict(self, input_image_path, prompt, negative_prompt, controlnet_scale):
|
| 77 |
+
pipe = load_model(self.lora_dir, self.cn_dir)
|
| 78 |
input_image_pil = Image.open(input_image_path)
|
| 79 |
base_size = input_image_pil.size
|
| 80 |
resize_image = resize_image_aspect_ratio(input_image_pil)
|