Spaces:
Runtime error
Runtime error
davidrd123
commited on
Commit
•
f091eea
1
Parent(s):
9758658
added code + images
Browse files- .gitattributes +5 -0
- Image00.jpg +0 -0
- Image01.jpg +0 -0
- Image02.jpg +3 -0
- Image03.jpg +0 -0
- Image04.jpg +3 -0
- Image05.jpg +0 -0
- Image06.jpg +3 -0
- Image07.jpg +0 -0
- Image08.jpg +3 -0
- Image09.jpg +3 -0
- app.py +24 -0
- requirements.txt +2 -0
.gitattributes
CHANGED
@@ -26,3 +26,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
28 |
rn50_256px_18genre_10epoch_err313.pkl filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
28 |
rn50_256px_18genre_10epoch_err313.pkl filter=lfs diff=lfs merge=lfs -text
|
29 |
+
Image06.jpg filter=lfs diff=lfs merge=lfs -text
|
30 |
+
Image08.jpg filter=lfs diff=lfs merge=lfs -text
|
31 |
+
Image04.jpg filter=lfs diff=lfs merge=lfs -text
|
32 |
+
Image09.jpg filter=lfs diff=lfs merge=lfs -text
|
33 |
+
Image02.jpg filter=lfs diff=lfs merge=lfs -text
|
Image00.jpg
ADDED
Image01.jpg
ADDED
Image02.jpg
ADDED
Git LFS Details
|
Image03.jpg
ADDED
Image04.jpg
ADDED
Git LFS Details
|
Image05.jpg
ADDED
Image06.jpg
ADDED
Git LFS Details
|
Image07.jpg
ADDED
Image08.jpg
ADDED
Git LFS Details
|
Image09.jpg
ADDED
Git LFS Details
|
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner('rn50_256px_18genre_10epoch_err313.pkl')
|
6 |
+
|
7 |
+
labels = learn.dls.vocab
|
8 |
+
def predict(img):
|
9 |
+
img = PILImage.create(img)
|
10 |
+
pred,pred_idx,probs = learn.predict(img)
|
11 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
12 |
+
|
13 |
+
examples = [f"Image{n:02d}.jpg" for n in range(10)]
|
14 |
+
interpretation='default'
|
15 |
+
title = "Art Movement Classifier - WikiArt"
|
16 |
+
description = "What Art Movement Matches the Image Best?"
|
17 |
+
|
18 |
+
gr.Interface(fn=predict,
|
19 |
+
inputs=gr.inputs.Image(shape=((512,512))),
|
20 |
+
outputs=gr.outputs.Label(num_top_classes=5),
|
21 |
+
title = title,
|
22 |
+
examples = examples,
|
23 |
+
interpretation = interpretation,
|
24 |
+
description = description).launch(share=True, enable_queue=True)
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|