Spaces:
Sleeping
Sleeping
initial commit
Browse files- app.py +18 -0
- assets/abajur.png +0 -0
- assets/cone.png +0 -0
- assets/pedestre.png +0 -0
- assets/poste.png +0 -0
- assets/stop.png +0 -0
- model.pkl +3 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner('model.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 |
+
title = "Identifica Objeto"
|
14 |
+
examples = ['assets/stop.png', 'assets/cone.png', 'assets/pedestre.png', 'assets/abajur.png', 'assets/poste.png']
|
15 |
+
interpretation='default'
|
16 |
+
enable_queue=True
|
17 |
+
|
18 |
+
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=5),title=title,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
|
assets/abajur.png
ADDED
assets/cone.png
ADDED
assets/pedestre.png
ADDED
assets/poste.png
ADDED
assets/stop.png
ADDED
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3d072145f0fa93611b17dc6325be5ce953e9e03ef49ce6eb39dafd0dbe134060
|
3 |
+
size 46968197
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|