|
|
--- |
|
|
title: AI Art Historian |
|
|
emoji: π¨ |
|
|
colorFrom: blue |
|
|
colorTo: purple |
|
|
sdk: gradio |
|
|
sdk_version: 5.33.0 |
|
|
app_file: app.py |
|
|
pinned: true |
|
|
license: mit |
|
|
short_description: Expert AI artwork analysis with historical insights |
|
|
tags: |
|
|
- agent-demo-track |
|
|
--- |
|
|
|
|
|
# π¨ AI Art Historian |
|
|
|
|
|
**Expert-level artwork analysis powered by Microsoft Phi-3.5-Vision and SmolAgent Framework** |
|
|
|
|
|
## π How to use |
|
|
|
|
|
1. **Upload an artwork** - Supports JPG, PNG and other image formats |
|
|
2. **Ask questions** (optional) - Get specific analysis on style, symbols, or history |
|
|
3. **Get expert analysis** - Receive detailed art historical insights in seconds |
|
|
|
|
|
### Core Components |
|
|
|
|
|
#### 1. **Vision Agent** - Phi-3.5-Vision-Instruct |
|
|
- Converts artwork images to detailed descriptions |
|
|
- Identifies visual elements, colors, composition, style indicators |
|
|
|
|
|
#### 2. **Analysis Agent** - SmolAgent Framework |
|
|
- Processes descriptions using specialized art tools |
|
|
- Multi-step reasoning for comprehensive analysis |
|
|
- Fallback system for reliability |
|
|
|
|
|
## π§ Specialized Tools |
|
|
|
|
|
### π¨ Style Detector |
|
|
```python |
|
|
@tool |
|
|
def art_style_detector(visual_description: str) -> str: |
|
|
"""Identifies artistic movements and styles""" |
|
|
``` |
|
|
**Detects**: Renaissance, Baroque, Impressionism, Expressionism, Cubism, Surrealism, Abstract, Pop Art, Minimalism |
|
|
|
|
|
### π Historical Context Provider |
|
|
```python |
|
|
@tool |
|
|
def historical_context_provider(art_period: str) -> str: |
|
|
"""Provides historical and cultural context""" |
|
|
``` |
|
|
**Includes**: Time periods, key artists, cultural influences, movement characteristics |
|
|
|
|
|
### π Symbolism Interpreter |
|
|
```python |
|
|
@tool |
|
|
def symbolism_interpreter(visual_elements: str) -> str: |
|
|
"""Decodes symbolic meanings in artwork""" |
|
|
``` |
|
|
**Analyzes**: Colors (red, blue, gold), Objects (crown, flowers, skull), Religious symbols (cross, dove) |
|
|
|
|
|
## β‘ Processing Workflow |
|
|
|
|
|
1. **Image Analysis**: Phi-3.5-Vision describes artwork details |
|
|
2. **Agent Reasoning**: SmolAgent processes description using tools: |
|
|
- Style detection from visual cues |
|
|
- Historical context for identified period |
|
|
- Symbol interpretation from elements |
|
|
3. **Structured Output**: Comprehensive art historical analysis |
|
|
|
|
|
## π‘οΈ Robust Design |
|
|
|
|
|
- **Dual Processing**: Vision model + reasoning agent |
|
|
- **Fallback System**: Direct tool usage if agent fails |
|
|
- **GPU Optimization**: Fast image processing |
|
|
- **Dark Theme**: Eye-friendly interface |
|
|
|
|
|
## π Acknowledgements |
|
|
|
|
|
Made with β€οΈ by **Gizem Sarsinlar** ([@gizemsarsinlar](https://huggingface.co/gizemsarsinlar)) |
|
|
|
|
|
## π₯ Demo Video |
|
|
|
|
|
Watch the full project walkthrough and live demonstration: |
|
|
|
|
|
[](https://youtu.be/xyNKr05Vvls?si=OmHjtOfBez2FjOTv) |
|
|
|