rafaelcarvalhoj commited on
Commit
bb474b1
1 Parent(s): dbd1984

Classificador de Tubarão

Browse files
Files changed (7) hide show
  1. app.py +27 -0
  2. export.pkl +3 -0
  3. gshark.jpg +0 -0
  4. hshark.jpg +0 -0
  5. requirements.txt +2 -0
  6. tshark.jpg +0 -0
  7. wshark.jpg +0 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+
5
+ learn = load_learner('export.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 = "Shark Classifier"
14
+ description = "Classificador de algumas espécies de tubarão treinada pela Rede Neural resnet 18 através da biblioteca do fastai"
15
+ examples = ['gshark.jpg','tshark.jpg','hshark.jpg','wshark.jpg']
16
+ interpretation='default'
17
+ enable_queue=True
18
+
19
+ gr.Interface(fn=predict,
20
+ inputs=gr.inputs.Image(shape=(512, 512)),
21
+ outputs=gr.outputs.Label(num_top_classes=3),
22
+ title=title,
23
+ description=description,
24
+ examples=examples,
25
+ interpretation=interpretation,
26
+ enable_queue=enable_queue
27
+ ).launch()
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4523fadb10a769338d79d9ef55fee161ed0518670cd66becaa91755ff848e5f5
3
+ size 46962526
gshark.jpg ADDED
hshark.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image
tshark.jpg ADDED
wshark.jpg ADDED