Fix ModelRegistry params and Gradio Blocks compatibility

- Fix ModelRegistry init params: config_path, max_cached_models, idle_timeout_minutes
- Make gr.Blocks creation compatible with different Gradio versions

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-26 23:28:41 +01:00
parent 626fb8d02f
commit cdb420d0f7
2 changed files with 17 additions and 10 deletions

View File

@@ -50,9 +50,10 @@ async def initialize_services():
# Initialize model registry
logger.info("Initializing model registry...")
model_registry = ModelRegistry(
config_path=settings.models_config,
gpu_manager=gpu_manager,
max_loaded=settings.max_loaded_models,
idle_timeout_seconds=settings.idle_unload_minutes * 60,
max_cached_models=settings.max_loaded_models,
idle_timeout_minutes=settings.idle_unload_minutes,
)
# Initialize services

View File

@@ -5,7 +5,7 @@ import gradio as gr
from typing import Any, Optional
from pathlib import Path
from src.ui.theme import create_audiocraft_theme, get_custom_css
from src.ui.theme import get_custom_css
from src.ui.state import UIState, DEFAULT_PRESETS, PROMPT_SUGGESTIONS
from src.ui.components.vram_monitor import create_vram_monitor
from src.ui.tabs import (
@@ -190,15 +190,21 @@ class AudioCraftApp:
def build(self) -> gr.Blocks:
"""Build the Gradio application."""
theme = create_audiocraft_theme()
css = get_custom_css()
with gr.Blocks(
theme=theme,
# Create Blocks with compatible parameters
try:
# Gradio 4.x
app = gr.Blocks(
theme=gr.themes.Soft(),
css=css,
title="AudioCraft Studio",
analytics_enabled=False,
) as app:
)
except TypeError:
# Fallback for older Gradio versions
app = gr.Blocks(css=css)
with app:
# Header with VRAM monitor
with gr.Row():
with gr.Column(scale=4):