74fef908d2
Graduated heads can now apply their tag without a human — gated so it's safe:
- FIRING GATE: a head fires only when the master switch (head_auto_apply_enabled,
default OFF) is on AND it has >= head_auto_apply_min_positives (default 30)
clean labels. A precise-looking but under-supported low-N head can't spray tags.
- auto_apply_sweep (heads.py): streams every embedded image in chunks, scores
against the eligible heads (numpy, no sklearn), applies each head's tag where
score >= its auto_apply_threshold and the tag isn't already applied/rejected,
with source='head_auto' (distinguishable + reversible). dry_run counts only.
- HeadAutoApplyRun (migration 0059) tracks each sweep / preview; apply_head_tags
task (ml queue) + scheduled_apply_head_tags daily beat (no-op unless enabled)
+ recovery sweep + retention(20).
- API: POST /api/heads/auto-apply {dry_run} (202 / 409 running / 400 disabled),
GET /api/heads/auto-apply (recent runs + per-concept report). Settings
head_auto_apply_enabled + min_positives via /api/ml/settings.
Tests: sweep applies above threshold, dry-run writes nothing, skips under-
supported + ungraduated heads; API disabled/dry-run/conflict guards.
NEXT (slice 2): the observability the operator asked for — per-concept misfire
(auto-applied-then-removed) + under-fire tracking, time-series snapshots, and a
reporting API to tune. Slice 3: the UI (enable, preview, trends).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ttrj5P7upUTueSfoJcxEqa
82 lines
2.4 KiB
Python
82 lines
2.4 KiB
Python
"""All ORM models. Import this module to make every model visible to Alembic."""
|
|
|
|
from .app_setting import AppSetting
|
|
from .artist import Artist
|
|
from .artist_visit import ArtistVisit
|
|
from .backup_run import BackupRun
|
|
from .base import Base
|
|
from .credential import Credential
|
|
from .download_event import DownloadEvent
|
|
from .external_link import ExternalLink
|
|
from .head_auto_apply_run import HeadAutoApplyRun
|
|
from .head_training_run import HeadTrainingRun
|
|
from .image_prediction import ImagePrediction
|
|
from .image_provenance import ImageProvenance
|
|
from .image_record import ImageRecord
|
|
from .import_batch import ImportBatch
|
|
from .import_settings import ImportSettings
|
|
from .import_task import ImportTask
|
|
from .library_audit_run import LibraryAuditRun
|
|
from .ml_settings import MLSettings
|
|
from .patreon_failed_media import PatreonFailedMedia
|
|
from .patreon_seen_media import PatreonSeenMedia
|
|
from .post import Post
|
|
from .post_attachment import PostAttachment
|
|
from .series_chapter import SeriesChapter
|
|
from .series_page import SeriesPage
|
|
from .series_suggestion import SeriesSuggestion
|
|
from .source import Source
|
|
from .subscribestar_failed_media import SubscribeStarFailedMedia
|
|
from .subscribestar_seen_media import SubscribeStarSeenMedia
|
|
from .tag import Tag, TagKind, image_tag
|
|
from .tag_alias import TagAlias
|
|
from .tag_allowlist import TagAllowlist
|
|
from .tag_eval_run import TagEvalRun
|
|
from .tag_head import TagHead
|
|
from .tag_positive_confirmation import TagPositiveConfirmation
|
|
from .tag_reference_embedding import TagReferenceEmbedding
|
|
from .tag_suggestion_rejection import TagSuggestionRejection
|
|
from .task_run import TaskRun
|
|
|
|
__all__ = [
|
|
"Base",
|
|
"AppSetting",
|
|
"Artist",
|
|
"ArtistVisit",
|
|
"BackupRun",
|
|
"Source",
|
|
"Credential",
|
|
"PatreonFailedMedia",
|
|
"PatreonSeenMedia",
|
|
"SubscribeStarFailedMedia",
|
|
"SubscribeStarSeenMedia",
|
|
"Post",
|
|
"PostAttachment",
|
|
"SeriesChapter",
|
|
"SeriesPage",
|
|
"SeriesSuggestion",
|
|
"ImageRecord",
|
|
"ImagePrediction",
|
|
"ImageProvenance",
|
|
"Tag",
|
|
"TagKind",
|
|
"image_tag",
|
|
"DownloadEvent",
|
|
"ExternalLink",
|
|
"ImportBatch",
|
|
"ImportTask",
|
|
"ImportSettings",
|
|
"LibraryAuditRun",
|
|
"MLSettings",
|
|
"HeadAutoApplyRun",
|
|
"HeadTrainingRun",
|
|
"TagAlias",
|
|
"TagAllowlist",
|
|
"TagEvalRun",
|
|
"TagHead",
|
|
"TagPositiveConfirmation",
|
|
"TagReferenceEmbedding",
|
|
"TagSuggestionRejection",
|
|
"TaskRun",
|
|
]
|