Change gr output
Browse files
app.py
CHANGED
@@ -26,9 +26,10 @@ def titanic(Pclass, Sex, Age, SibSp):
|
|
26 |
res = model.predict(np.asarray(input_list).reshape(1, -1))
|
27 |
# We add '[0]' to the result of the transformed 'res', because 'res' is a list, and we only want
|
28 |
# the first element.
|
29 |
-
flower_url = "https://raw.githubusercontent.com/featurestoreorg/serverless-ml-course/main/src/01-module/assets/" + res[0] + ".png"
|
30 |
-
img = Image.open(requests.get(flower_url, stream=True).raw)
|
31 |
-
return img
|
|
|
32 |
|
33 |
demo = gr.Interface(
|
34 |
fn=titanic,
|
@@ -41,7 +42,7 @@ demo = gr.Interface(
|
|
41 |
gr.inputs.Number(default=1.0, label="Age (in years)"),
|
42 |
gr.inputs.Number(default=1.0, label="SibSp (number of siblings)"),
|
43 |
],
|
44 |
-
outputs=gr.
|
45 |
|
46 |
demo.launch()
|
47 |
|
|
|
26 |
res = model.predict(np.asarray(input_list).reshape(1, -1))
|
27 |
# We add '[0]' to the result of the transformed 'res', because 'res' is a list, and we only want
|
28 |
# the first element.
|
29 |
+
# flower_url = "https://raw.githubusercontent.com/featurestoreorg/serverless-ml-course/main/src/01-module/assets/" + res[0] + ".png"
|
30 |
+
# img = Image.open(requests.get(flower_url, stream=True).raw)
|
31 |
+
# return img
|
32 |
+
return res[0]
|
33 |
|
34 |
demo = gr.Interface(
|
35 |
fn=titanic,
|
|
|
42 |
gr.inputs.Number(default=1.0, label="Age (in years)"),
|
43 |
gr.inputs.Number(default=1.0, label="SibSp (number of siblings)"),
|
44 |
],
|
45 |
+
outputs=gr.Textbox(label="Result: "))
|
46 |
|
47 |
demo.launch()
|
48 |
|