Update app.py
Browse files
app.py
CHANGED
@@ -19,9 +19,9 @@ infer_tfms = tfms.A.Adapter([*tfms.A.resize_and_pad(384),tfms.A.Normalize()])
|
|
19 |
# Definimos una función que se encarga de llevar a cabo las predicciones
|
20 |
def predict(img):
|
21 |
img = PIL.Image.open(img)
|
22 |
-
pred_dict
|
23 |
return pred_dict["img"]
|
24 |
|
25 |
# Creamos la interfaz y la lanzamos.
|
26 |
-
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(128, 128)), outputs=gr.outputs.Image(
|
27 |
examples=['raccoon-161.jpg','raccoon-162.jpg']).launch(share=False)
|
|
|
19 |
# Definimos una función que se encarga de llevar a cabo las predicciones
|
20 |
def predict(img):
|
21 |
img = PIL.Image.open(img)
|
22 |
+
pred_dict = model_type(img, infer_tfms, model.to("cpu"), class_map=ClassMap(['raccoon']), detection_threshold=0.5)
|
23 |
return pred_dict["img"]
|
24 |
|
25 |
# Creamos la interfaz y la lanzamos.
|
26 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(128, 128)), outputs=[gr.outputs.Image(type="pil", label="VFNet Inference")],
|
27 |
examples=['raccoon-161.jpg','raccoon-162.jpg']).launch(share=False)
|