Spaces:
Runtime error
Runtime error
File size: 1,650 Bytes
d8d35e1 6674317 d8d35e1 cfa9fef d8d35e1 3cf0c60 d8d35e1 f12ccdb 6674317 3cf0c60 b76ecdb 60a9dbb a962382 d8d35e1 87a1ca2 d8d35e1 3cf0c60 d8d35e1 3cf0c60 d8d35e1 3cf0c60 d2965ed c1552b6 fe3adbc b76ecdb f12ccdb d8d35e1 |
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 50 51 |
import gradio as gr
import numpy as np
from PIL import Image
import requests
import hopsworks
import joblib
project = hopsworks.login()
fs = project.get_feature_store()
mr = project.get_model_registry()
model = mr.get_model("titanic_modal_more_specs", version=2)
model_dir = model.download()
model = joblib.load(model_dir + "/titanic_model.pkl")
def tb_titanic(pclass,sex,age,sibsp,parch,embarked,fare_per_customer,cabin):
input_list = []
input_list.append(pclass)
input_list.append(sex)
input_list.append(age)
input_list.append(sibsp)
input_list.append(parch)
input_list.append(embarked)
input_list.append(fare_per_customer)
input_list.append(cabin)
# 'res' is a list of predictions returned as the label.
#global res
res = model.predict(np.asarray(input_list).reshape(1, 8))
return "This guy will"
demo = gr.Interface(
fn=tb_titanic,
title="Titanic Predictive Analytics",
description="Predict survivals. 0 for dead and 1 for survived. ",
inputs=[
gr.inputs.Number(default=1.0, label="pclass"),
gr.inputs.Number(default=1.0, label="gender"),
gr.inputs.Number(default=1.0, label="age"),
gr.inputs.Number(default=1.0, label="sibsp"),
gr.inputs.Number(default=1.0, label="parch"),
gr.inputs.Number(default=1.0, label="embarked"),
gr.inputs.Number(default=1.0, label="fare_per_customer"),
gr.inputs.Number(default=1.0, label="cabin"),
],
outputs=gr.Textbox()
)
# outputs=gr.outputs.Textbox(self,type="auto",label="Hi"))
#("This guy will"+("survive. " if res[0]==1 else "die. ")
demo.launch()
|