Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,15 @@
|
|
| 1 |
from icevision.all import *
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
# Cargamos el learner
|
| 5 |
-
learn =
|
| 6 |
|
| 7 |
-
# Definimos las etiquetas de nuestro modelo
|
| 8 |
-
labels = learn.dls.vocab
|
| 9 |
-
|
| 10 |
# Definimos una funci贸n que se encarga de llevar a cabo las predicciones
|
| 11 |
def predict(img):
|
| 12 |
img = PILImage.create(img)
|
| 13 |
-
pred,pred_idx,probs = learn.predict(img)
|
| 14 |
-
return
|
| 15 |
|
| 16 |
# Creamos la interfaz y la lanzamos.
|
| 17 |
-
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(128, 128)), outputs=gr.outputs.
|
|
|
|
| 1 |
from icevision.all import *
|
| 2 |
+
import torch
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
# Cargamos el learner
|
| 6 |
+
learn = torch.load('fasterRCNNKangaroo_obligatorio.pth')
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
# Definimos una funci贸n que se encarga de llevar a cabo las predicciones
|
| 9 |
def predict(img):
|
| 10 |
img = PILImage.create(img)
|
| 11 |
+
#pred,pred_idx,probs = learn.predict(img)
|
| 12 |
+
return img
|
| 13 |
|
| 14 |
# Creamos la interfaz y la lanzamos.
|
| 15 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(128, 128)), outputs=gr.outputs.Image(label='Imagen resultado'),examples=['0024cdab0c1e.png','005b95c28852.png']).launch(share=False)
|