INNER CODE UNIT · Python

change_model

virajmavani/semi-auto-image-annotation-tool · web/backend/main.py:371

async def change_model(model_id: str = Form(...), threshold: float = Form(0.5)):
    """Change the current model or threshold"""
    global current_model, current_model_type, current_threshold

    try:
        # Validate model exists
        if model_id not in AVAILABLE_MODELS:
            raise HTTPException(status_code=404, detail=f"Model '{model_id}' not found")

        model_info = AVAILABLE_MODELS[model_id]

        # Load the appropriate model based on framework
        if model_info["framework"] == "pytorch":
            new_model = ModelFactory.create_model(
                model_info["type"],
                threshold=threshold,
                weights_path=model_info["weights_path"]
            )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…