Datasculptor Datasculptor commited on
Commit
d186f68
·
0 Parent(s):

Duplicate from Datasculptor/AIart_sources_of_inspiration

Browse files

Co-authored-by: Dariusz Gross MLearning.ai <[email protected]>

.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Identifying Painting Authors
3
+ emoji: 🎨
4
+ colorFrom: indigo
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: 3.12.0
8
+ app_file: app.py
9
+ pinned: false
10
+ duplicated_from: Datasculptor/AIart_sources_of_inspiration
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tensorflow as tf
2
+ import pandas as pd
3
+ import gradio as gr
4
+
5
+ authors_df = pd.read_csv('authors.csv')
6
+ labels = sorted(list(authors_df.name))
7
+
8
+ model = tf.keras.models.load_model('efficientnetb0.h5')
9
+
10
+ description = 'This is a DEMO that attempts to recognize the inspirations used by the AI art generator. After uploading a picture of an image, the application displays the predicted artist along with the probability of predicting the top three authors.The DEMO uses EfficientNetB0 convolutional neural network as a base model whose classifier was modified and trained the 8,000+ paintings from [Kaggle](https://www.kaggle.com/datasets/ikarus777/best-artworks-of-all-time) dataset. Model trained by osydorchuk89. Given the dataset limitations, the model only recognizes paintings of [50 artists](https://huggingface.co/spaces/osydorchuk/painting_authors/blob/main/authors.csv).'
11
+
12
+ def predict_author(input):
13
+ if input is None:
14
+ return 'Please upload an image'
15
+ input = input.reshape((-1, 224, 224, 3))
16
+ prediction = model.predict(input).flatten()
17
+ confidences = {labels[i]: float(prediction[i]) for i in range(50)}
18
+ return confidences
19
+
20
+ demo = gr.Interface(
21
+ title='the AI art generator sources of inspiration',
22
+ description=description,
23
+ fn=predict_author,
24
+ inputs=gr.Image(shape=(224, 224)),
25
+ outputs=gr.Label(num_top_classes=3),
26
+ examples=['test_pics/eva_miro.jpg', 'test_pics/eva_bosch.jpg', 'test_pics/eva_miro_2.jpg', 'test_pics/eva_rtology.jpg']
27
+ )
28
+
29
+ demo.launch()
authors.csv ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ id,name
2
+ 0,Amedeo Modigliani
3
+ 1,Vasiliy Kandinskiy
4
+ 2,Diego Rivera
5
+ 3,Claude Monet
6
+ 4,Rene Magritte
7
+ 5,Salvador Dali
8
+ 6,Edouard Manet
9
+ 7,Andrei Rublev
10
+ 8,Vincent van Gogh
11
+ 9,Gustav Klimt
12
+ 10,Hieronymus Bosch
13
+ 11,Kazimir Malevich
14
+ 12,Mikhail Vrubel
15
+ 13,Pablo Picasso
16
+ 14,Peter Paul Rubens
17
+ 15,Pierre-Auguste Renoir
18
+ 16,Francisco Goya
19
+ 17,Frida Kahlo
20
+ 18,El Greco
21
+ 19,Albrecht Durer
22
+ 20,Alfred Sisley
23
+ 21,Pieter Bruegel
24
+ 22,Marc Chagall
25
+ 23,Giotto di Bondone
26
+ 24,Sandro Botticelli
27
+ 25,Caravaggio
28
+ 26,Leonardo da Vinci
29
+ 27,Diego Velazquez
30
+ 28,Henri Matisse
31
+ 29,Jan van Eyck
32
+ 30,Edgar Degas
33
+ 31,Rembrandt
34
+ 32,Titian
35
+ 33,Henri de Toulouse-Lautrec
36
+ 34,Gustave Courbet
37
+ 35,Camille Pissarro
38
+ 36,William Turner
39
+ 37,Edvard Munch
40
+ 38,Paul Cezanne
41
+ 39,Eugene Delacroix
42
+ 40,Henri Rousseau
43
+ 41,Georges Seurat
44
+ 42,Paul Klee
45
+ 43,Piet Mondrian
46
+ 44,Joan Miro
47
+ 45,Andy Warhol
48
+ 46,Paul Gauguin
49
+ 47,Raphael
50
+ 48,Michelangelo
51
+ 49,Jackson Pollock
52
+
efficientnetb0.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b37633e2aa793bda5c6934ea002c10eed66c6973c31a80dc44ed7a669a1291a
3
+ size 17362032
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ pandas
2
+ tensorflow==2.9.0
3
+ gradio
test_pics/eva_bosch.jpg ADDED
test_pics/eva_miro.jpg ADDED
test_pics/eva_miro_2.jpg ADDED
test_pics/eva_rtology.jpg ADDED