Spaces:
Runtime error
Runtime error
import joblib | |
import gradio as gr | |
import pandas as pd | |
pipe = joblib.load('pipe.joblib') | |
def pred(pi, pt, pla, ss, pr, gs): | |
df = pd.DataFrame( | |
{ | |
"Pelvic incidence": pi, | |
"Pelvic tilt": pt, | |
"Lumbar lordosis angle": pla, | |
"Sacral slope": ss, | |
"pelvic radius": pr, | |
"grade of spondylolisthesis": gs | |
}, | |
index=[0] | |
) | |
prediction = pipe.predict(df.values) | |
if (prediction[0]==0): | |
output = 'Normal' | |
elif (prediction[0]==1): | |
output = 'Anormal' | |
return "La predicción es "+output+'.' | |
iface = gr.Interface( | |
pred, | |
[ | |
gr.Slider(-99,99,label="Pelvic incidence", value=0), | |
gr.Slider(-99,99,label="Pelvic tilt", value=0), | |
gr.Slider(-99,99,label="Lumbar lordosis angle", value=0), | |
gr.Slider(-99,99,label="Sacral slope", value=0), | |
gr.Slider(-99,99,label="Pelvic radius", value=0), | |
gr.Slider(-99,99,label="Grade of spondylolisthesis", value=0), | |
], | |
"text", | |
examples=[ | |
[63.0278175, 22.55258597, 39.60911701, 40.47523153, 98.67291675, -0.254399986], | |
[40.34929637, 10.19474845, 37.96774659, 30.15454792, 128.0099272, 0.458901373], | |
[118.1446548, 38.44950127, 50.83851954, 79.69515353, 81.0245406, 74.04376736], | |
[33.78884314, 3.675109986, 25.5, 30.11373315, 128.3253556, -1.776111234], | |
], | |
title = 'Orthopaedic column prediction', | |
) | |
iface.launch() |