""" Simple customizable annotation GUI with auto-labeling support. Built with Gradio - easy to modify and extend. Run: python annotation_gui.py To set default paths, edit config.py """ from __future__ import annotations import argparse import html import json import subprocess import threading from pathlib import Path from typing import Any import gradio as gr from PIL import Image, ImageDraw # Try to load config, use fallbacks if not available try: from config import ( DEFAULT_IMAGES_DIR, DEFAULT_MODEL_WEIGHTS, DEFAULT_PORT, DEFAULT_DETECTION_THRESHOLD, DEFAULT_TRAIN_EPOCHS, DEFAULT_BATCH_SIZE, DEFAULT_LEARNING_RATE, DEFAULT_MODEL_SIZE ) except ImportError: DEFAULT_IMAGES_DIR = None DEFAULT_MODEL_WEIGHTS = None DEFAULT_PORT = 7860 DEFAULT_DETECTION_THRESHOLD = 0.5 DEFAULT_TRAIN_EPOCHS = 20 DEFAULT_BATCH_SIZE = 4 DEFAULT_LEARNING_RATE = 1e-4 DEFAULT_MODEL_SIZE = "small" # Gradio 6 sanitizes