Upload agents/text_agent.py with huggingface_hub
Browse files- agents/text_agent.py +11 -1
agents/text_agent.py
CHANGED
|
@@ -25,12 +25,22 @@ Your 9 analysis domains:
|
|
| 25 |
|
| 26 |
8. CONTEXTUAL APPROPRIATENESS: Signs should contain text appropriate for their context (restaurant β food items, street β street name, storefront β business name). ALSO check for ABSENCE of expected text: a storefront with no name, a book with no title, a commercial product with no label β these absences can indicate AI generation.
|
| 27 |
|
| 28 |
-
9. REFLECTION/SHADOW TEXT: If text is reflected in mirrors, water, or shiny surfaces, the reflection must be geometrically correct (horizontally mirrored). Text shadows must match the text geometry and scene lighting direction. Shadow letters should match the shape of the source letters.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
USR_TEXT = """Perform a comprehensive typographic forensic analysis of ALL visible text in this image.
|
| 31 |
|
| 32 |
For each text element you find, analyze all 9 domains.
|
| 33 |
|
|
|
|
|
|
|
| 34 |
ALSO check for ABSENCE of expected text: If the scene contains surfaces that would normally have text (storefronts, product labels, book covers, road signs, vehicle plates, clothing brand logos) but they are blank, blurred, or contain gibberish, flag this as suspicious.
|
| 35 |
|
| 36 |
If NO text is visible at all, assess whether the scene type would normally contain text. A close-up portrait with no text is normal. A street scene with no signs at all is unusual.
|
|
|
|
| 25 |
|
| 26 |
8. CONTEXTUAL APPROPRIATENESS: Signs should contain text appropriate for their context (restaurant β food items, street β street name, storefront β business name). ALSO check for ABSENCE of expected text: a storefront with no name, a book with no title, a commercial product with no label β these absences can indicate AI generation.
|
| 27 |
|
| 28 |
+
9. REFLECTION/SHADOW TEXT: If text is reflected in mirrors, water, or shiny surfaces, the reflection must be geometrically correct (horizontally mirrored). Text shadows must match the text geometry and scene lighting direction. Shadow letters should match the shape of the source letters.
|
| 29 |
+
|
| 30 |
+
CRITICAL β WHITEBOARD, SCREEN, AND HANDWRITTEN TEXT ANALYSIS:
|
| 31 |
+
AI-generated images frequently contain whiteboards, screens, notebooks, or documents with text that looks plausible at first glance but fails under scrutiny. You MUST carefully analyze:
|
| 32 |
+
- WHITEBOARD CONTENT: Read every word on visible whiteboards. Check for: repeated headers/phrases, flowcharts with impossible logic loops, bullet points that say the same thing twice, diagrams that don't connect properly, text that trails off into gibberish.
|
| 33 |
+
- SCREEN/MONITOR TEXT: Text on computer screens, phones, or tablets. Is it real readable content or visual noise that resembles text?
|
| 34 |
+
- HANDWRITTEN TEXT: Handwriting should have natural variation. AI handwriting is often too uniform or has inconsistent stroke pressure.
|
| 35 |
+
- DUPLICATED TEXT: If the same phrase appears twice in different locations on a whiteboard or sign, this is a strong AI indicator β real handwriting is never accidentally duplicated.
|
| 36 |
+
These are among the STRONGEST tells for AI-generated professional/office images.""" + CONFIDENCE_CALIBRATION
|
| 37 |
|
| 38 |
USR_TEXT = """Perform a comprehensive typographic forensic analysis of ALL visible text in this image.
|
| 39 |
|
| 40 |
For each text element you find, analyze all 9 domains.
|
| 41 |
|
| 42 |
+
CRITICAL: Pay special attention to WHITEBOARDS, SCREENS, and HANDWRITTEN TEXT. AI-generated images almost always contain subtle text errors on these surfaces β repeated phrases, nonsensical diagrams, duplicated headers, or text that looks coherent from a distance but contains gibberish up close. Read every word carefully.
|
| 43 |
+
|
| 44 |
ALSO check for ABSENCE of expected text: If the scene contains surfaces that would normally have text (storefronts, product labels, book covers, road signs, vehicle plates, clothing brand logos) but they are blank, blurred, or contain gibberish, flag this as suspicious.
|
| 45 |
|
| 46 |
If NO text is visible at all, assess whether the scene type would normally contain text. A close-up portrait with no text is normal. A street scene with no signs at all is unusual.
|