Spaces:
Runtime error
Runtime error
Download app.py from mariofilho/gradio_tutorial: direct link, hf CLI and curl.
- Browser
- Download file 555 Bytes
-
https://huggingface.co/spaces/mariofilho/gradio_tutorial/resolve/main/app.py
- Command line
-
hf download hf://spaces/mariofilho/gradio_tutorial/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mariofilho/gradio_tutorial/resolve/main/app.py
555 Bytes
| import gradio as gr | |
| import joblib as jb | |
| def predict(sex, age, pclass): | |
| model = jb.load('model.pkl') | |
| pclass = int(pclass) | |
| p = model.predict_proba([[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() |