Upload pipeline_input_processor.py
Browse files4 unmodified lines567889101145 unmodified lines57585960616263646574 unmodified lines140141142143144145146147148225 unmodified lines3743753763773783793803813824 unmodified linesfrom PIL import Image, ImageChops
from typing import Dict, Any, List
from core.settings import INPUT_DIR, MULTIPLIERS_MAP
from core.settings import INPUT_DIR, MULTIPLIERS_MAP, LORA_DIR, EMBEDDING_DIR, VAE_DIR
from utils.app_utils import (
sanitize_filename,
get_lora_path,45 unmodified lines lora_filename = None
if source == "File":
lora_filename = sanitize_filename(lora_id)
local_path = os.path.join(LORA_DIR, lora_filename)
if not os.path.exists(local_path):
raise gr.Error(f"Uploaded LoRA file '{lora_id}' no longer exists on server. Please re-upload it.")
elif source in ("Civitai", "Hugging Face"):
local_path, status = get_lora_path(source, lora_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
if local_path: lora_filename = os.path.basename(local_path)74 unmodified lines emb_filename = None
if source == "File":
emb_filename = sanitize_filename(emb_id)
local_path = os.path.join(EMBEDDING_DIR, emb_filename)
if not os.path.exists(local_path):
raise gr.Error(f"Uploaded Embedding file '{emb_id}' no longer exists on server. Please re-upload it.")
elif source in ("Civitai", "Hugging Face"):
local_path, status = get_embedding_path(source, emb_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
if local_path: emb_filename = os.path.basename(local_path)225 unmodified lines if vae_source and vae_source != "None":
if vae_source == "File":
vae_name_override = sanitize_filename(vae_id)
local_path = os.path.join(VAE_DIR, vae_name_override)
if not os.path.exists(local_path):
raise gr.Error(f"Uploaded VAE file '{vae_id}' no longer exists on server. Please re-upload it.")
elif vae_source in ("Civitai", "Hugging Face") and vae_id and vae_id.strip():
local_path, status = get_vae_path(vae_source, vae_id, os.environ.get("CIVITAI_API_KEY", ""), progress)
if local_path: vae_name_override = os.path.basename(local_path)core/pipelines/pipeline_input_processor.py+10-1