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:
5
main.py
5
main.py
@@ -50,9 +50,10 @@ async def initialize_services():
|
|||||||
# Initialize model registry
|
# Initialize model registry
|
||||||
logger.info("Initializing model registry...")
|
logger.info("Initializing model registry...")
|
||||||
model_registry = ModelRegistry(
|
model_registry = ModelRegistry(
|
||||||
|
config_path=settings.models_config,
|
||||||
gpu_manager=gpu_manager,
|
gpu_manager=gpu_manager,
|
||||||
max_loaded=settings.max_loaded_models,
|
max_cached_models=settings.max_loaded_models,
|
||||||
idle_timeout_seconds=settings.idle_unload_minutes * 60,
|
idle_timeout_minutes=settings.idle_unload_minutes,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Initialize services
|
# Initialize services
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import gradio as gr
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
from pathlib import Path
|
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.state import UIState, DEFAULT_PRESETS, PROMPT_SUGGESTIONS
|
||||||
from src.ui.components.vram_monitor import create_vram_monitor
|
from src.ui.components.vram_monitor import create_vram_monitor
|
||||||
from src.ui.tabs import (
|
from src.ui.tabs import (
|
||||||
@@ -190,15 +190,21 @@ class AudioCraftApp:
|
|||||||
|
|
||||||
def build(self) -> gr.Blocks:
|
def build(self) -> gr.Blocks:
|
||||||
"""Build the Gradio application."""
|
"""Build the Gradio application."""
|
||||||
theme = create_audiocraft_theme()
|
|
||||||
css = get_custom_css()
|
css = get_custom_css()
|
||||||
|
|
||||||
with gr.Blocks(
|
# Create Blocks with compatible parameters
|
||||||
theme=theme,
|
try:
|
||||||
css=css,
|
# Gradio 4.x
|
||||||
title="AudioCraft Studio",
|
app = gr.Blocks(
|
||||||
analytics_enabled=False,
|
theme=gr.themes.Soft(),
|
||||||
) as app:
|
css=css,
|
||||||
|
title="AudioCraft Studio",
|
||||||
|
)
|
||||||
|
except TypeError:
|
||||||
|
# Fallback for older Gradio versions
|
||||||
|
app = gr.Blocks(css=css)
|
||||||
|
|
||||||
|
with app:
|
||||||
# Header with VRAM monitor
|
# Header with VRAM monitor
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Column(scale=4):
|
with gr.Column(scale=4):
|
||||||
|
|||||||
Reference in New Issue
Block a user