Updated generation pages.
This commit is contained in:
@@ -6,6 +6,22 @@ from flask import current_app
|
||||
logger = logging.getLogger('gaze')
|
||||
|
||||
|
||||
def get_loaded_checkpoint():
|
||||
"""Return the checkpoint path currently loaded in ComfyUI, or None."""
|
||||
try:
|
||||
url = current_app.config.get('COMFYUI_URL', 'http://127.0.0.1:8188')
|
||||
resp = requests.get(f'{url}/history', timeout=3)
|
||||
if resp.ok:
|
||||
history = resp.json()
|
||||
if history:
|
||||
latest = max(history.values(), key=lambda j: j.get('status', {}).get('status_str', ''))
|
||||
nodes = latest.get('prompt', [None, None, {}])[2]
|
||||
return nodes.get('4', {}).get('inputs', {}).get('ckpt_name')
|
||||
except Exception:
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
def _ensure_checkpoint_loaded(checkpoint_path):
|
||||
"""Check if the desired checkpoint is loaded in ComfyUI, and force reload if not."""
|
||||
if not checkpoint_path:
|
||||
|
||||
Reference in New Issue
Block a user