Spaces:
Runtime error
Runtime error
import gradio as gr | |
from fastai.vision.all import * | |
import skimage | |
def get_masa(): return 0 | |
def get_volumen(): return 0 | |
learn1 = load_learner('convnext_base_Masa_Height.pkl') | |
learn2 = load_learner('resnetrs50Masav2Height.pkl') | |
learn3 = load_learner('convnext_base_Masa.pkl') | |
learn4 = load_learner('resnetrs50VolumenHeight.pkl') | |
def predict(Imagen_Ortophoto,Imagen_Altura): | |
imgOrtophoto = PILImage.create(Imagen_Ortophoto) | |
imgAltura = PILImage.create(Imagen_Altura) | |
_,pred1,_ = learn1.predict(imgAltura) | |
_,pred2,_ = learn1.predict(imgAltura) | |
_,pred3,_ = learn3.predict(imgOrtophoto) | |
_,pred4,_ = learn4.predict(imgAltura) | |
return (pred1[0]+pred2[0]+pred3[0])/3,pred4 | |
title = "Cálculo de masa de silos" | |
description = "Demo para el proyecto SEPARA." | |
examples = [['ortophoto1.jpg','altura1.jpg'],['ortophoto2.jpg','altura2.jpg']] | |
interpretation='default' | |
enable_queue=True | |
gr.Interface(fn=predict,inputs=[gr.inputs.Image(shape=(224,224)),gr.inputs.Image(shape=(224,224))],outputs=[gr.outputs.Textbox(label="masa"),gr.outputs.Textbox(label="volumen")],title=title,description=description,examples=examples,enable_queue=enable_queue).launch() | |