File size: 1,172 Bytes
19ecb9a
 
 
98a9c00
19ecb9a
86ab4df
fda63ad
86ab4df
a0fe8c8
3eed4dc
5b2caa2
ff2e3c2
19ecb9a
 
853b51f
 
 
791fbf4
3eed4dc
791fbf4
ff2e3c2
 
19ecb9a
 
 
834d2af
19ecb9a
 
 
ff2e3c2
19ecb9a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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()