browser audio detection phase 3

This commit is contained in:
Joren de Graaf
2026-10-02 21:34:38 +02:00
parent c68e4b95ba
commit 1de4b8a0b3
50 changed files with 24755 additions and 144 deletions
+18 -2
View File
@@ -22,7 +22,7 @@ from django.views.decorators.http import require_http_methods
from .h3_utils import cell_boundary, cell_center, cell_from_coordinates, h3_resolution
from .browser_policy import advisory_browser_metadata, browser_config, browser_policy
from .models import ClassificationRule, Event, PendingEvent, Sensor
from .models import BrowserProcessingSettings, ClassificationRule, Event, PendingEvent, Sensor
CLASSIFIER_URL = "http://192.168.1.122:5000/classify"
@@ -286,7 +286,23 @@ def classify_upload(request):
# Keep the raw payload in this request flow; this is the future hand-off point
# for saving the upload and its classification to a database or queue.
context = _classification_context(payload)
context["submission_token"] = signing.dumps(payload, salt="fireworks_detect.classification")
override = (
BrowserProcessingSettings.enabled()
and metadata.get("browser_override") is True
and metadata.get("browser_gate_result") in {"speech_only", "no_match"}
)
if override:
# The browser gate is advisory. Always classify server-side first, then
# force this explicit override into Pending Review regardless of scores.
pending = PendingEvent.objects.create(
audio_file=uploaded_file,
original_filename=uploaded_file.name,
classifier_response=payload,
)
context["pending"] = pending
logger.info("Browser override sent to Pending Review: %s", pending.pk)
else:
context["submission_token"] = signing.dumps(payload, salt="fireworks_detect.classification")
return render(request, "fireworks_detect/classification_result.html", context)