Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,37 +1,32 @@
|
|
1 |
-
from cProfile import label
|
2 |
-
from logging import PlaceHolder
|
3 |
-
from operator import mod
|
4 |
import gradio as gr
|
5 |
import pandas as pd
|
6 |
-
|
7 |
-
from joblib import load
|
8 |
|
9 |
-
def predict_bodymass(
|
10 |
-
|
11 |
-
):
|
12 |
-
model=load("penguin_predictor.jb")
|
13 |
|
14 |
-
# Create
|
15 |
-
data={
|
16 |
-
"FlipperLength":[FlipperLength]
|
17 |
}
|
18 |
-
|
19 |
-
|
20 |
-
bodymass=model.predict(xin)
|
21 |
return bodymass[0]
|
22 |
|
23 |
-
|
24 |
fn=predict_bodymass,
|
25 |
inputs=[
|
26 |
-
gr.inputs.
|
|
|
|
|
|
|
|
|
|
|
27 |
],
|
28 |
-
|
29 |
-
title="PENGUIN REGRESSION"
|
30 |
-
outputs="text",
|
31 |
-
examples=[[195],
|
32 |
-
[183]]
|
33 |
-
|
34 |
)
|
35 |
|
36 |
-
if __name__=="__main__":
|
37 |
-
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
+
from joblib import load
|
|
|
4 |
|
5 |
+
def predict_bodymass(FlipperLength):
|
6 |
+
model = load("penguin_predictor.jb")
|
|
|
|
|
7 |
|
8 |
+
# Create DataFrame from input
|
9 |
+
data = {
|
10 |
+
"FlipperLength": [FlipperLength]
|
11 |
}
|
12 |
+
xin = pd.DataFrame(data)
|
13 |
+
|
14 |
+
bodymass = model.predict(xin)
|
15 |
return bodymass[0]
|
16 |
|
17 |
+
iface = gr.Interface(
|
18 |
fn=predict_bodymass,
|
19 |
inputs=[
|
20 |
+
gr.inputs.Number(
|
21 |
+
label="Flipper Length (mm)",
|
22 |
+
min_value=0,
|
23 |
+
max_value=500,
|
24 |
+
default=0
|
25 |
+
)
|
26 |
],
|
27 |
+
outputs=gr.outputs.Textbox(label="Body Mass"),
|
28 |
+
title="PENGUIN REGRESSION"
|
|
|
|
|
|
|
|
|
29 |
)
|
30 |
|
31 |
+
if __name__ == "__main__":
|
32 |
+
iface.launch()
|