Spaces:
Sleeping
Sleeping
| """ | |
| Configuration settings for the music generation app | |
| """ | |
| import os | |
| from dataclasses import dataclass | |
| from typing import List, Dict | |
| class ModelConfig: | |
| name: str | |
| repo_id: str | |
| max_duration: int | |
| default_params: Dict | |
| description: str | |
| # Model configurations | |
| MODELS = { | |
| "musicgen_small": ModelConfig( | |
| name="MusicGen Small", | |
| repo_id="facebook/musicgen-small", | |
| max_duration=30, | |
| default_params={ | |
| "guidance_scale": 3, | |
| "do_sample": True, | |
| "temperature": 1.0, | |
| "top_k": 50 | |
| }, | |
| description="Fast, lightweight model for quick generation" | |
| ), | |
| "musicgen_melody": ModelConfig( | |
| name="MusicGen Melody", | |
| repo_id="facebook/musicgen-melody", | |
| max_duration=30, | |
| default_params={ | |
| "guidance_scale": 3, | |
| "do_sample": True, | |
| "temperature": 1.0, | |
| "top_k": 50 | |
| }, | |
| description="Enhanced model with melody conditioning" | |
| ), | |
| "audioldm": ModelConfig( | |
| name="AudioLDM", | |
| repo_id="cvssp/audioldm-s-full-v2", | |
| max_duration=20, | |
| default_params={ | |
| "num_inference_steps": 50, | |
| "guidance_scale": 2.5 | |
| }, | |
| description="Latent diffusion model for high-quality audio" | |
| ) | |
| } | |
| # App settings | |
| APP_SETTINGS = { | |
| "max_file_size_mb": 50, | |
| "supported_formats": [".wav", ".mp3", ".flac", ".ogg"], | |
| "max_batch_size": 10, | |
| "cache_duration_hours": 24, | |
| "enable_gpu": True, | |
| "share_gradio": True, | |
| "show_error_details": True | |
| } | |
| # UI settings | |
| UI_SETTINGS = { | |
| "theme": "soft", | |
| "show_api_info": False, | |
| "show_progress": True, | |
| "enable_queue": True, | |
| "max_threads": 4 | |
| } | |
| # Generation presets | |
| PRESETS = { | |
| "Electronic": { | |
| "prompt": "electronic dance music, 128 BPM, synthesizers, kick drum", | |
| "duration": 15, | |
| "model": "musicgen_small" | |
| }, | |
| "Jazz": { | |
| "prompt": "smooth jazz, piano, saxophone, double bass, 90 BPM", | |
| "duration": 20, | |
| "model": "musicgen_melody" | |
| }, | |
| "Classical": { | |
| "prompt": "classical orchestral music, strings, woodwinds, dramatic", | |
| "duration": 25, | |
| "model": "audioldm" | |
| }, | |
| "Ambient": { | |
| "prompt": "ambient electronic, atmospheric, pad synthesizers, slow", | |
| "duration": 30, | |
| "model": "audioldm" | |
| } | |
| } |