File size: 821 Bytes
27e5e0b
7e7ca0a
27e5e0b
7e7ca0a
27e5e0b
7e7ca0a
 
 
48e5de2
7e7ca0a
 
 
 
48e5de2
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from joblib import load

model = load('model_regr_et_combined.joblib') 

labels = ['EDW','ENACW12', 'WNACW7', 'SPMW', 'SACWT12', 'SACWE12', 'WW', 'AAIW5','AAIW3', 'MW', 'LSW', 'ISOW', 'DSOW', 'CDW', 'WSDW', 'SAIW']


def predict(latitude=-57.4997,longitude=-31.5992,ctdprs=347.9,ctdpot=1.8694, ctdsal=34.587):
    res = model.predict([[latitude,longitude,ctdprs,ctdpot, ctdsal]])
    probs = res[0]
    return {labels[i]: float(probs[i]) for i in range(len(labels))}

example = [-57.4997,-31.5992,347.9,1.8694,34.587]
iface = gr.Interface(fn=predict, inputs=[gr.inputs.Number(label="Latitude"), gr.inputs.Number(label="Longitude"), gr.inputs.Number(label="CTDPRS"), gr.inputs.Number(label="CTDPOT"),gr.inputs.Number(label="CTDSAL")], outputs=gr.outputs.Label(),examples=[example]).launch(share=False)