Spaces:
Runtime error
Runtime error
Daniel-Sousa
commited on
Commit
•
2e0ede2
1
Parent(s):
b41d6c0
Upload 5 files
Browse files- .gitattributes +2 -0
- app.py +30 -0
- eggman.jpg +3 -0
- model.pkl +3 -0
- requirements.txt +2 -0
- sonic.jpg +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
eggman.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
+
sonic.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner('model.pkl')
|
6 |
+
|
7 |
+
categories = ('Sonic the Hedgehog', 'Doutor Eggman')
|
8 |
+
examples = ['sonic.jpg', 'eggman.jpg']
|
9 |
+
|
10 |
+
|
11 |
+
labels = learn.dls.vocab
|
12 |
+
def predict(img):
|
13 |
+
img = PILImage.create(img)
|
14 |
+
pred,pred_idx,probs = learn.predict(img)
|
15 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
16 |
+
|
17 |
+
title = "Sonic the Hedgehog and Doutor Eggman"
|
18 |
+
description = "Classificador entre o Sonic e o Doutor Eggman"
|
19 |
+
examples = ['sonic.jpg', 'eggman.jpg']
|
20 |
+
interpretation='default'
|
21 |
+
enable_queue=True
|
22 |
+
|
23 |
+
gr.Interface(fn=predict,
|
24 |
+
inputs=gr.inputs.Image(shape=(512, 512)),
|
25 |
+
outputs=gr.outputs.Label(num_top_classes=2),
|
26 |
+
title=title,
|
27 |
+
description=description,
|
28 |
+
examples=examples,
|
29 |
+
interpretation=interpretation,
|
30 |
+
enable_queue=enable_queue).launch(share=True)
|
eggman.jpg
ADDED
Git LFS Details
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:066c5050719a0569e40214e6ed84b75855bb1b03b73bdbe03f93a301897bace7
|
3 |
+
size 87457561
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|
sonic.jpg
ADDED
Git LFS Details
|