File size: 548 Bytes
24b3899
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
import joblib as jb

def predict(sex, age, pclass):
    model = jb.load('model-teste.pkl')
    pclass = int(pclass)
    p = model.predict({{sex, age, pclass}})[0]

    return {"Did not survive": p[0], "Survived": p[1]}


demo = gr.Interface(fn=predict,
                   inputs=[gr.Dropdown(choices=["male", "female"], type="index"),
                          "number",
                          gr.Dropdown(choices=["1", "2", "3"], type="value")
                          ],
                    outputs="label")

demo.launch()