Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +49 -0
- pipe.joblib +3 -0
app.py
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import joblib
|
2 |
+
import gradio as gr
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
pipe = joblib.load('pipe.joblib')
|
6 |
+
|
7 |
+
def pred(pi, pt, pla, ss, pr, gs):
|
8 |
+
df = pd.DataFrame(
|
9 |
+
{
|
10 |
+
"Pelvic incidence": pi,
|
11 |
+
"Pelvic tilt": pt,
|
12 |
+
"Lumbar lordosis angle": pla,
|
13 |
+
"Sacral slope": ss,
|
14 |
+
"pelvic radius": pr,
|
15 |
+
"grade of spondylolisthesis": gs
|
16 |
+
},
|
17 |
+
index=[0]
|
18 |
+
)
|
19 |
+
|
20 |
+
prediction = pipe.predict(df.values)
|
21 |
+
|
22 |
+
if (prediction[0]==0):
|
23 |
+
output = 'Normal'
|
24 |
+
elif (prediction[0]==1):
|
25 |
+
output = 'Anormal'
|
26 |
+
return "La predicción es "+output+'.'
|
27 |
+
|
28 |
+
iface = gr.Interface(
|
29 |
+
pred,
|
30 |
+
[
|
31 |
+
gr.Slider(-99,99,label="Pelvic incidence", value=0),
|
32 |
+
gr.Slider(-99,99,label="Pelvic tilt", value=0),
|
33 |
+
gr.Slider(-99,99,label="Lumbar lordosis angle", value=0),
|
34 |
+
gr.Slider(-99,99,label="Sacral slope", value=0),
|
35 |
+
gr.Slider(-99,99,label="Pelvic radius", value=0),
|
36 |
+
gr.Slider(-99,99,label="Grade of spondylolisthesis", value=0),
|
37 |
+
],
|
38 |
+
|
39 |
+
"text",
|
40 |
+
examples=[
|
41 |
+
[63.0278175, 22.55258597, 39.60911701, 40.47523153, 98.67291675, -0.254399986],
|
42 |
+
[40.34929637, 10.19474845, 37.96774659, 30.15454792, 128.0099272, 0.458901373],
|
43 |
+
[118.1446548, 38.44950127, 50.83851954, 79.69515353, 81.0245406, 74.04376736],
|
44 |
+
[33.78884314, 3.675109986, 25.5, 30.11373315, 128.3253556, -1.776111234],
|
45 |
+
],
|
46 |
+
title = 'Orthopaedic column prediction',
|
47 |
+
)
|
48 |
+
|
49 |
+
iface.launch()
|
pipe.joblib
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2617d6ad558609bccb3be20c5759d3aa9ba43df0b0aa681ba715117e508560ad
|
3 |
+
size 11561
|