Spaces:
Sleeping
Sleeping
""" | |
配置文件 | |
""" | |
import os | |
from typing import Dict, Any | |
# 文件限制 | |
MAX_FILE_SIZE_MB = 50 | |
SUPPORTED_FORMATS = ['.obj', '.glb', '.ply', '.stl'] | |
# 处理参数 | |
DEFAULT_PROCESSING_PARAMS = { | |
'input_pc_num': 8192, | |
'confidence_threshold': 0.8, | |
'generate_preview': True, | |
'timeout_seconds': 120, | |
} | |
# 演示提示模板 | |
DEMO_PROMPTS = { | |
'human': "realistic human skeleton for walking and animation", | |
'animal': "four-legged animal with spine and tail bones for natural movement", | |
'robot': "mechanical robot with joint articulation for industrial movements", | |
'bird': "bird skeleton with wing bones for flight animation", | |
'generic': "articulated skeleton suitable for animation" | |
} | |
# 示例模型描述 | |
EXAMPLE_MODELS = [ | |
{ | |
'name': 'Boy Character', | |
'file': 'boy.obj', | |
'prompt': DEMO_PROMPTS['human'], | |
'description': 'Human character suitable for walk cycle and basic animations' | |
}, | |
{ | |
'name': 'Dog Model', | |
'file': 'dog.obj', | |
'prompt': DEMO_PROMPTS['animal'], | |
'description': 'Quadruped animal with natural bone structure' | |
}, | |
{ | |
'name': 'Bird Model', | |
'file': 'bird.obj', | |
'prompt': DEMO_PROMPTS['bird'], | |
'description': 'Bird with wing bones for flight animations' | |
}, | |
{ | |
'name': 'Robot/Mech', | |
'file': 'ironman.obj', | |
'prompt': DEMO_PROMPTS['robot'], | |
'description': 'Mechanical character with joint-based movement' | |
} | |
] | |
# UI配置 | |
UI_CONFIG = { | |
'title': '🎯 MagicArticulate MVP', | |
'description': """ | |
AI-powered 3D model articulation using skeletal generation. | |
Upload a 3D model and get an automatically generated skeleton for animation. | |
""", | |
'theme': 'soft', | |
'show_tips': True, | |
'max_examples': 4 | |
} | |
# 性能配置 | |
PERFORMANCE_CONFIG = { | |
'use_gpu': True, | |
'mixed_precision': 'fp16', | |
'batch_size': 1, | |
'max_concurrent_requests': 2, | |
'cleanup_temp_files': True | |
} | |
def get_config() -> Dict[str, Any]: | |
"""获取完整配置""" | |
return { | |
'file_limits': { | |
'max_size_mb': MAX_FILE_SIZE_MB, | |
'supported_formats': SUPPORTED_FORMATS | |
}, | |
'processing': DEFAULT_PROCESSING_PARAMS, | |
'prompts': DEMO_PROMPTS, | |
'examples': EXAMPLE_MODELS, | |
'ui': UI_CONFIG, | |
'performance': PERFORMANCE_CONFIG | |
} |