Upload pipeline_input_processor.py
Browse files
core/pipelines/pipeline_input_processor.py
CHANGED
|
@@ -5,7 +5,7 @@ import gradio as gr
|
|
| 5 |
from PIL import Image, ImageChops
|
| 6 |
from typing import Dict, Any, List
|
| 7 |
|
| 8 |
-
from core.settings import INPUT_DIR, MULTIPLIERS_MAP
|
| 9 |
from utils.app_utils import (
|
| 10 |
sanitize_filename,
|
| 11 |
get_lora_path,
|
|
@@ -57,6 +57,9 @@ def process_pipeline_inputs(ui_inputs: Dict[str, Any], progress: gr.Progress, wo
|
|
| 57 |
lora_filename = None
|
| 58 |
if source == "File":
|
| 59 |
lora_filename = sanitize_filename(lora_id)
|
|
|
|
|
|
|
|
|
|
| 60 |
elif source in ("Civitai", "Hugging Face"):
|
| 61 |
local_path, status = get_lora_path(source, lora_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
|
| 62 |
if local_path: lora_filename = os.path.basename(local_path)
|
|
@@ -137,6 +140,9 @@ def process_pipeline_inputs(ui_inputs: Dict[str, Any], progress: gr.Progress, wo
|
|
| 137 |
emb_filename = None
|
| 138 |
if source == "File":
|
| 139 |
emb_filename = sanitize_filename(emb_id)
|
|
|
|
|
|
|
|
|
|
| 140 |
elif source in ("Civitai", "Hugging Face"):
|
| 141 |
local_path, status = get_embedding_path(source, emb_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
|
| 142 |
if local_path: emb_filename = os.path.basename(local_path)
|
|
@@ -368,6 +374,9 @@ def process_pipeline_inputs(ui_inputs: Dict[str, Any], progress: gr.Progress, wo
|
|
| 368 |
if vae_source and vae_source != "None":
|
| 369 |
if vae_source == "File":
|
| 370 |
vae_name_override = sanitize_filename(vae_id)
|
|
|
|
|
|
|
|
|
|
| 371 |
elif vae_source in ("Civitai", "Hugging Face") and vae_id and vae_id.strip():
|
| 372 |
local_path, status = get_vae_path(vae_source, vae_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
|
| 373 |
if local_path: vae_name_override = os.path.basename(local_path)
|
|
|
|
| 5 |
from PIL import Image, ImageChops
|
| 6 |
from typing import Dict, Any, List
|
| 7 |
|
| 8 |
+
from core.settings import INPUT_DIR, MULTIPLIERS_MAP, LORA_DIR, EMBEDDING_DIR, VAE_DIR
|
| 9 |
from utils.app_utils import (
|
| 10 |
sanitize_filename,
|
| 11 |
get_lora_path,
|
|
|
|
| 57 |
lora_filename = None
|
| 58 |
if source == "File":
|
| 59 |
lora_filename = sanitize_filename(lora_id)
|
| 60 |
+
local_path = os.path.join(LORA_DIR, lora_filename)
|
| 61 |
+
if not os.path.exists(local_path):
|
| 62 |
+
raise gr.Error(f"Uploaded LoRA file '{lora_id}' no longer exists on server. Please re-upload it.")
|
| 63 |
elif source in ("Civitai", "Hugging Face"):
|
| 64 |
local_path, status = get_lora_path(source, lora_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
|
| 65 |
if local_path: lora_filename = os.path.basename(local_path)
|
|
|
|
| 140 |
emb_filename = None
|
| 141 |
if source == "File":
|
| 142 |
emb_filename = sanitize_filename(emb_id)
|
| 143 |
+
local_path = os.path.join(EMBEDDING_DIR, emb_filename)
|
| 144 |
+
if not os.path.exists(local_path):
|
| 145 |
+
raise gr.Error(f"Uploaded Embedding file '{emb_id}' no longer exists on server. Please re-upload it.")
|
| 146 |
elif source in ("Civitai", "Hugging Face"):
|
| 147 |
local_path, status = get_embedding_path(source, emb_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
|
| 148 |
if local_path: emb_filename = os.path.basename(local_path)
|
|
|
|
| 374 |
if vae_source and vae_source != "None":
|
| 375 |
if vae_source == "File":
|
| 376 |
vae_name_override = sanitize_filename(vae_id)
|
| 377 |
+
local_path = os.path.join(VAE_DIR, vae_name_override)
|
| 378 |
+
if not os.path.exists(local_path):
|
| 379 |
+
raise gr.Error(f"Uploaded VAE file '{vae_id}' no longer exists on server. Please re-upload it.")
|
| 380 |
elif vae_source in ("Civitai", "Hugging Face") and vae_id and vae_id.strip():
|
| 381 |
local_path, status = get_vae_path(vae_source, vae_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
|
| 382 |
if local_path: vae_name_override = os.path.basename(local_path)
|