File size: 1,472 Bytes
dfcb06d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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()