Michael Rey commited on
Commit
191dff2
·
1 Parent(s): 0f170f4

added working app

Browse files
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .env
.gradio/flagged/Upload Artwork/dcea6d73ed2117a56f0d/e1145a73413575203600558a9e7e0348.jpg ADDED
.gradio/flagged/dataset1.csv ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Upload Artwork,output,timestamp
2
+ .gradio\flagged\Upload Artwork\dcea6d73ed2117a56f0d\e1145a73413575203600558a9e7e0348.jpg,"This artwork is a highly stylized, almost childlike interpretation of Leonardo da Vinci's *Mona Lisa*. It's not a forgery in the traditional sense – a fraudulent attempt to pass off a work as an original masterpiece – but rather a deliberate reimagining or appropriation. Let's break down its characteristics:
3
+
4
+ **Style:** The style is decidedly naive or folk art. It eschews the sfumato technique and realistic anatomical detail of the original, opting for bold outlines, flat planes of color, and a simplified representation of form. The style is reminiscent of children's drawings or certain forms of folk art where simplicity and bold colors take precedence over precise realism. There's a strong sense of immediacy and lack of concern for photorealism.
5
+
6
+ **Brushstrokes:** The ""brushstrokes"" appear digital, lacking the texture and physicality of actual paint. They're solid blocks of color with relatively hard edges, suggesting a digital painting or graphic design program was used. The lack of blending and the flatness of the application are key indicators of this digital approach.
7
+
8
+ **Color Palette:** The palette is vibrant and somewhat unnaturalistic. The background is a clashing blue and green, not typical of the muted earth tones in da Vinci's original. The purple of Mona Lisa's dress is a strong, saturated color, unlike the more subdued tones in the original. The bright yellow sun and flowers further emphasize the work's non-realistic approach.
9
+
10
+ **Composition:** The composition largely follows the original's basic structure: a seated figure with a landscape background. However, the simplification of the background reduces its depth and atmosphere. The landscape is childlike in its depiction – again, suggesting a naive or folk art aesthetic. The overall composition lacks the subtle balance and refined details characteristic of the Renaissance.
11
+
12
+ **Historical Context:** The artwork cannot be placed within any specific historical artistic movement. The style is too contemporary to be linked to any traditional school. Its relationship to Da Vinci's *Mona Lisa* is entirely in its subject matter; the style is an intentional departure from the original's Renaissance style.
13
+
14
+ **Forgery?** As stated above, this is not a forgery in the traditional sense. No one could seriously attempt to pass this off as a genuine Leonardo da Vinci. It’s a contemporary artwork inspired by the *Mona Lisa*, executed in a completely different artistic style. The deliberate simplification and use of digital tools clearly signal it is a modern creation that consciously plays with the iconic image of the Mona Lisa. It could be considered a commentary on, or a playful homage to, the original masterpiece.
15
+ ",2025-05-24 20:26:21.366081
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: M.O.N.A
3
- emoji: 💻
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
 
1
  ---
2
  title: M.O.N.A
3
+ emoji: 🎨
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+ import io
4
+ import os
5
+ from dotenv import load_dotenv
6
+ import google.generativeai as genai
7
+
8
+ # Load API key from .env or environment
9
+ load_dotenv()
10
+ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
11
+
12
+ # Initialize the Gemini model
13
+ model = genai.GenerativeModel("gemini-1.5-flash")
14
+
15
+ def analyze_artwork(image: Image.Image):
16
+ if image is None:
17
+ return "Please upload an image."
18
+
19
+ # Convert image to bytes
20
+ img_bytes = io.BytesIO()
21
+ image.save(img_bytes, format="JPEG")
22
+ img_bytes = img_bytes.getvalue()
23
+
24
+ try:
25
+ response = model.generate_content([
26
+ "You are an expert art historian. Analyze this artwork image in detail. "
27
+ "Comment on its style, brushstrokes, color palette, composition, possible historical context, "
28
+ "and whether it might be a forgery.",
29
+ {"mime_type": "image/jpeg", "data": img_bytes}
30
+ ])
31
+ return response.text
32
+
33
+ except Exception as e:
34
+ return f"Error calling Gemini API:\n{e}"
35
+
36
+ # Gradio interface
37
+ gInterface = gr.Interface(
38
+ fn=analyze_artwork,
39
+ inputs=gr.Image(type="pil", label="Upload Artwork"),
40
+ outputs="text",
41
+ title="🖼️ M.O.N.A - Machine for Objective Neural Art-analysis",
42
+ description="Upload an artwork and get analysis that provides objective insight. Powered by Google's Gemini AI."
43
+ )
44
+
45
+ gInterface.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio
2
+ google-generativeai
3
+ Pillow
4
+ python-dotenv