Spaces:
Sleeping
Sleeping
File size: 768 Bytes
9fcb893 a3be06d 9fcb893 a3be06d 9fcb893 1a1b190 9fcb893 1a1b190 9fcb893 d91f62f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
from fastai.vision.all import load_learner
import gradio as gr
art_labels= [
"Art Nouveau",
"Constructivism Art",
"Cubism Art",
"Dadaism Art",
"Fauvism Art",
"Gothic Art",
"Minimalism Art",
"Pointillism Art",
"Pop Art",
"Prehistoric Art"
]
model = load_learner('models/artStyle_recognizer-v5.pk1')
def recognize_image(image):
_, _, probs = model.predict(image)
return dict(zip(art_labels, map(float, probs)))
image = gr.Image()
label = gr.Label()
example = [
'Art Nouvaeu.jpg',
'Constructivism art.jpg',
'Fauvism art.jpg',
'Gothic art.jpeg',
'Minimalistic art.jpg'
]
iface = gr.Interface(fn = recognize_image, inputs = image, outputs = label, examples = example)
iface.launch(inline=False)
|