Spaces:
Runtime error
Runtime error
Create image_detector.py
Browse files- image_detector.py +4 -2
image_detector.py
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import logging
|
| 2 |
from typing import Dict, Any
|
| 3 |
from agentic_reliability_framework.runtime.agents.base import BaseAgent, AgentSpecialization
|
|
@@ -20,7 +24,6 @@ class ImageQualityDetector(BaseAgent):
|
|
| 20 |
Analyze image generation event.
|
| 21 |
Expects `retrieval_scores` to contain [retrieval_score, generation_time].
|
| 22 |
"""
|
| 23 |
-
# Default values
|
| 24 |
gen_time = 1.0
|
| 25 |
if event.retrieval_scores and len(event.retrieval_scores) > 1:
|
| 26 |
gen_time = event.retrieval_scores[1]
|
|
@@ -29,7 +32,6 @@ class ImageQualityDetector(BaseAgent):
|
|
| 29 |
if gen_time > self._thresholds['generation_time']:
|
| 30 |
flags.append('slow_generation')
|
| 31 |
|
| 32 |
-
# Confidence inversely related to generation time (heuristic)
|
| 33 |
confidence = max(0, 1.0 - (gen_time / 5.0))
|
| 34 |
|
| 35 |
return {
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Image quality detector based on generation time.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
import logging
|
| 6 |
from typing import Dict, Any
|
| 7 |
from agentic_reliability_framework.runtime.agents.base import BaseAgent, AgentSpecialization
|
|
|
|
| 24 |
Analyze image generation event.
|
| 25 |
Expects `retrieval_scores` to contain [retrieval_score, generation_time].
|
| 26 |
"""
|
|
|
|
| 27 |
gen_time = 1.0
|
| 28 |
if event.retrieval_scores and len(event.retrieval_scores) > 1:
|
| 29 |
gen_time = event.retrieval_scores[1]
|
|
|
|
| 32 |
if gen_time > self._thresholds['generation_time']:
|
| 33 |
flags.append('slow_generation')
|
| 34 |
|
|
|
|
| 35 |
confidence = max(0, 1.0 - (gen_time / 5.0))
|
| 36 |
|
| 37 |
return {
|