Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files- core/model_manager.py +5 -1
- ui/layout.py +1 -0
core/model_manager.py
CHANGED
|
@@ -23,6 +23,7 @@ class ModelManager:
|
|
| 23 |
if hasattr(self, 'initialized'):
|
| 24 |
return
|
| 25 |
self.loaded_models: Dict[str, Any] = {}
|
|
|
|
| 26 |
self.initialized = True
|
| 27 |
print("✅ ModelManager initialized.")
|
| 28 |
|
|
@@ -145,7 +146,7 @@ class ModelManager:
|
|
| 145 |
required_set = set(required_models)
|
| 146 |
current_set = set(self.loaded_models.keys())
|
| 147 |
|
| 148 |
-
loras_changed =
|
| 149 |
|
| 150 |
models_to_unload = current_set - required_set
|
| 151 |
if models_to_unload or loras_changed:
|
|
@@ -171,7 +172,10 @@ class ModelManager:
|
|
| 171 |
loaded_model_data = self._load_model_combo(display_name, active_loras, progress)
|
| 172 |
self.loaded_models[display_name] = loaded_model_data
|
| 173 |
except Exception as e:
|
|
|
|
| 174 |
raise gr.Error(f"Failed to load model combo or apply LoRA for '{display_name}'. Reason: {e}")
|
|
|
|
|
|
|
| 175 |
else:
|
| 176 |
print(f"--- [ModelManager] All required models are already loaded. ---")
|
| 177 |
|
|
|
|
| 23 |
if hasattr(self, 'initialized'):
|
| 24 |
return
|
| 25 |
self.loaded_models: Dict[str, Any] = {}
|
| 26 |
+
self.last_active_loras: List[Dict[str, Any]] = []
|
| 27 |
self.initialized = True
|
| 28 |
print("✅ ModelManager initialized.")
|
| 29 |
|
|
|
|
| 146 |
required_set = set(required_models)
|
| 147 |
current_set = set(self.loaded_models.keys())
|
| 148 |
|
| 149 |
+
loras_changed = self.last_active_loras != active_loras
|
| 150 |
|
| 151 |
models_to_unload = current_set - required_set
|
| 152 |
if models_to_unload or loras_changed:
|
|
|
|
| 172 |
loaded_model_data = self._load_model_combo(display_name, active_loras, progress)
|
| 173 |
self.loaded_models[display_name] = loaded_model_data
|
| 174 |
except Exception as e:
|
| 175 |
+
self.last_active_loras = []
|
| 176 |
raise gr.Error(f"Failed to load model combo or apply LoRA for '{display_name}'. Reason: {e}")
|
| 177 |
+
|
| 178 |
+
self.last_active_loras = active_loras
|
| 179 |
else:
|
| 180 |
print(f"--- [ModelManager] All required models are already loaded. ---")
|
| 181 |
|
ui/layout.py
CHANGED
|
@@ -26,6 +26,7 @@ def build_ui(event_handler_function):
|
|
| 26 |
"This demo is a streamlined version of the [Comfy web UI](https://github.com/RioShiina47/comfy-webui)'s ImgGen functionality. "
|
| 27 |
"Other versions are also available: "
|
| 28 |
"[Z-Image](https://huggingface.co/spaces/RioShiina/ImageGen-Z-Image), "
|
|
|
|
| 29 |
"[Illstrious](https://huggingface.co/spaces/RioShiina/ImageGen-Illstrious), "
|
| 30 |
"[NoobAI](https://huggingface.co/spaces/RioShiina/ImageGen-NoobAI), "
|
| 31 |
"[Pony](https://huggingface.co/spaces/RioShiina/ImageGen-Pony1), "
|
|
|
|
| 26 |
"This demo is a streamlined version of the [Comfy web UI](https://github.com/RioShiina47/comfy-webui)'s ImgGen functionality. "
|
| 27 |
"Other versions are also available: "
|
| 28 |
"[Z-Image](https://huggingface.co/spaces/RioShiina/ImageGen-Z-Image), "
|
| 29 |
+
"[NewBie-Image](https://huggingface.co/spaces/RioShiina/ImageGen-NewBie-Image), "
|
| 30 |
"[Illstrious](https://huggingface.co/spaces/RioShiina/ImageGen-Illstrious), "
|
| 31 |
"[NoobAI](https://huggingface.co/spaces/RioShiina/ImageGen-NoobAI), "
|
| 32 |
"[Pony](https://huggingface.co/spaces/RioShiina/ImageGen-Pony1), "
|