INNER CODE UNIT · Python

get_labels

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

async def get_labels():
    """Get available COCO labels"""
    if current_model is None:
        raise HTTPException(status_code=500, detail="Model not loaded")

    labels = current_model.get_labels()
    return {"labels": labels}


@app.post("/api/upload")
async def upload_image(file: UploadFile = File(...)):
    """Upload an image file"""
    try:
        filename = Path(file.filename).name  # strip any directory components
        validate_filename(filename)
        if file.size and file.size > MAX_UPLOAD_SIZE:
            raise HTTPException(status_code=413, detail="File too large (max 50 MB)")
        # Save uploaded file

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…