Spaces:
Sleeping
Sleeping
starbotica
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -2,11 +2,18 @@ import gradio as gr
|
|
2 |
from fastai.vision.all import *
|
3 |
import skimage
|
4 |
|
5 |
-
|
|
|
|
|
|
|
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 |
|
|
|
2 |
from fastai.vision.all import *
|
3 |
import skimage
|
4 |
|
5 |
+
x,y = 280,70
|
6 |
+
ancho,alto = 1024,715
|
7 |
+
|
8 |
+
learn = load_learner('cirref.pkl')
|
9 |
|
10 |
labels = learn.dls.vocab
|
11 |
def predict(img):
|
12 |
+
|
13 |
img = PILImage.create(img)
|
14 |
+
#recortamos la parte de la imagen que nos interesa
|
15 |
+
img = img[y:alto,x:ancho]
|
16 |
+
|
17 |
pred,pred_idx,probs = learn.predict(img)
|
18 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
19 |
|