Update app.py
Browse files
app.py
CHANGED
@@ -10,42 +10,22 @@ project = hopsworks.login(api_key_value="0rdWXlLgEd3mkGOg.iRZ7TtAkWGPlJHNQcAEph6
|
|
10 |
fs = project.get_feature_store()
|
11 |
|
12 |
mr = project.get_model_registry()
|
13 |
-
model = mr.get_model("
|
14 |
model_dir = model.download()
|
15 |
-
model = joblib.load(model_dir + "/
|
16 |
|
17 |
|
18 |
-
def
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
input_list.append(SibSp)
|
24 |
-
# 'res' is a list of predictions returned as the label.
|
25 |
-
res = model.predict(np.asarray(input_list).reshape(1, -1))
|
26 |
-
# We add '[0]' to the result of the transformed 'res', because 'res' is a list, and we only want
|
27 |
-
# the first element.
|
28 |
-
# flower_url = "https://raw.githubusercontent.com/featurestoreorg/serverless-ml-course/main/src/01-module/assets/" + res[0] + ".png"
|
29 |
-
# img = Image.open(requests.get(flower_url, stream=True).raw)
|
30 |
-
# return img
|
31 |
-
if (res[0] == 0):
|
32 |
-
result = "I'm sorry, the person is dead"
|
33 |
-
else:
|
34 |
-
result = "Awesome, the person is survived!!!!!!"
|
35 |
-
return result
|
36 |
-
|
37 |
|
38 |
demo = gr.Interface(
|
39 |
fn=titanic,
|
40 |
-
title="
|
41 |
-
description="
|
42 |
allow_flagging="never",
|
43 |
-
inputs=[
|
44 |
-
gr.inputs.Number(default=1.0, label="Pclass (Flight class 1/2/3)"),
|
45 |
-
gr.inputs.Number(default=1.0, label="Sex (male=1/female=2)"),
|
46 |
-
gr.inputs.Number(default=1.0, label="Age (in years)"),
|
47 |
-
gr.inputs.Number(default=1.0, label="SibSp (number of siblings)"),
|
48 |
-
],
|
49 |
outputs=gr.Textbox(label="Result: "))
|
50 |
|
51 |
demo.launch()
|
|
|
10 |
fs = project.get_feature_store()
|
11 |
|
12 |
mr = project.get_model_registry()
|
13 |
+
model = mr.get_model("xgboost_model", version=1)
|
14 |
model_dir = model.download()
|
15 |
+
model = joblib.load(model_dir + "/model.pkl")
|
16 |
|
17 |
|
18 |
+
def forecast():
|
19 |
+
x = 0
|
20 |
+
#res = model.predict(x)
|
21 |
+
|
22 |
+
return 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
demo = gr.Interface(
|
25 |
fn=titanic,
|
26 |
+
title="Air Quality Prediction",
|
27 |
+
description="Get aqi value",
|
28 |
allow_flagging="never",
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
outputs=gr.Textbox(label="Result: "))
|
30 |
|
31 |
demo.launch()
|