Files
slahiriandClaude Opus 4.5 5086598eb8 feat: major refactor with prompt editor, improved templates, and reasoning control
## New Features
- Add web-based Prompt Editor at /sid/prompt-editor
  - Monaco editor with TOML syntax highlighting
  - File browser for prompt templates
  - Save with TOML validation and auto-backup
  - Reset to git default functionality

- Add prompt_generator_core.py for standalone batch processing
- Add sid_prompt_generator_v2.py with simplified interface
- Add sid_prompt_debug.py for prompt quality evaluation
- Add cv_analyzer.py for YOLO-based human detection

## Prompt Template Improvements
- Restructure prompts into separate TOML files (portrait, scene, classification)
- Add sentence-by-sentence structure for local models
- Add comprehensive hair texture vocabulary (straight/wavy/curly/bangs)
- Add makeup vocabulary (smoky eyes, lipstick colors)
- Improve basic tier prompts to output sentences instead of keyword lists

## API Call Optimization
- Standard mode: Single API call (ignores reasoning)
- Detailed + reasoning OFF: Single API call with detailed prompts
- Detailed + reasoning ON: Multi-step agentic analysis

## Dependencies
- Add aiohttp for web routes
- Add tomlkit for TOML editing with comment preservation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 14:05:01 +05:30

106 lines
3.2 KiB
Python

# -*- coding: utf-8 -*-
"""
System Information Gathering
Collects system information for debug evaluation context.
"""
import platform
import sys
from typing import Dict, Any
def get_system_info() -> Dict[str, Any]:
"""
Gather comprehensive system information.
Returns:
Dictionary with system details
"""
info = {
"platform": sys.platform,
"os_version": platform.platform(),
"python_version": platform.python_version(),
"architecture": platform.machine(),
}
# PyTorch and CUDA info
try:
import torch
info["torch_version"] = torch.__version__
info["cuda_available"] = torch.cuda.is_available()
if torch.cuda.is_available():
info["cuda_version"] = torch.version.cuda
info["gpu"] = {
"name": torch.cuda.get_device_name(0),
"vram_total_gb": round(torch.cuda.get_device_properties(0).total_memory / (1024**3), 1),
"vram_available_gb": round((torch.cuda.get_device_properties(0).total_memory - torch.cuda.memory_allocated(0)) / (1024**3), 1),
}
# Try to get driver version
try:
import subprocess
result = subprocess.run(['nvidia-smi', '--query-gpu=driver_version', '--format=csv,noheader'],
capture_output=True, text=True, timeout=5)
if result.returncode == 0:
info["gpu"]["driver_version"] = result.stdout.strip()
except:
pass
else:
info["gpu"] = None
except ImportError:
info["torch_version"] = "not installed"
info["cuda_available"] = False
info["gpu"] = None
# RAM info
try:
import psutil
mem = psutil.virtual_memory()
info["ram_total_gb"] = round(mem.total / (1024**3), 1)
info["ram_available_gb"] = round(mem.available / (1024**3), 1)
except ImportError:
info["ram_total_gb"] = None
info["ram_available_gb"] = None
# ComfyUI version (if available)
try:
# Try to get ComfyUI version from various sources
import importlib.metadata
try:
info["comfyui_version"] = importlib.metadata.version("comfyui")
except:
info["comfyui_version"] = "unknown"
except:
info["comfyui_version"] = "unknown"
return info
def get_gpu_memory_info() -> Dict[str, float]:
"""
Get current GPU memory usage.
Returns:
Dictionary with VRAM info in GB
"""
try:
import torch
if torch.cuda.is_available():
return {
"total_gb": round(torch.cuda.get_device_properties(0).total_memory / (1024**3), 2),
"allocated_gb": round(torch.cuda.memory_allocated(0) / (1024**3), 2),
"cached_gb": round(torch.cuda.memory_reserved(0) / (1024**3), 2),
"available_gb": round((torch.cuda.get_device_properties(0).total_memory - torch.cuda.memory_allocated(0)) / (1024**3), 2),
}
except:
pass
return {
"total_gb": 0,
"allocated_gb": 0,
"cached_gb": 0,
"available_gb": 0,
}