INNER CODE UNIT · Python

file_path

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

        file_path = UPLOAD_DIR / filename
        size_written = 0
        with open(file_path, "wb") as buffer:
            while chunk := await file.read(1024 * 1024):
                size_written += len(chunk)
                if size_written > MAX_UPLOAD_SIZE:
                    file_path.unlink(missing_ok=True)
                    raise HTTPException(status_code=413, detail="File too large (max 50 MB)")
                buffer.write(chunk)

        # Get image dimensions
        with Image.open(file_path) as img:
            width, height = img.size

        return {
            "filename": filename,
            "path": str(file_path),
            "width": width,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…