CoolFace
Apppublic

Rosana/gradio_tutorial

sourceHugging Faceupdated 4y agoView on Hugging Face
0likes
app.py20 linesDownload Raw Back to root
1import gradio as gr2import joblib as jb3 4def predict(sex, age, pclass):5    model = jb.load('model.pkl')6    pclass = int(pclass)7 8    p = model.predict_proba([[sex, age, pclass]])[0]9 10    return {'Did not survive': p[0], 'Survived': p[1]}11 12demo = gr.Interface(fn = predict,13inputs = [14    gr.Dropdown(choices=["male","female"], type="index"),15    "number",16    gr.Dropdown(choices=["1","2","3"], type="value")17],18outputs="label")19 20demo.launch()