Spaces:
Sleeping
Sleeping
Commit
·
fc183cd
1
Parent(s):
567f61a
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
import xgboost as xgb
|
4 |
+
import datasets
|
5 |
+
|
6 |
+
|
7 |
+
inputs = [gr.Dataframe(row_count = (2, "dynamic"), col_count=(38,"fixed"), label="Input Data", interactive=1)]
|
8 |
+
|
9 |
+
outputs = [gr.Dataframe(row_count = (2, "dynamic"), col_count=(1, "fixed"), label="Predictions", headers=["Failures"])]
|
10 |
+
|
11 |
+
model = xgb.XGBClassifier()
|
12 |
+
model.load("pdm_fail_20231206.json")
|
13 |
+
|
14 |
+
# we will give our dataframe as example
|
15 |
+
# df = datasets.load_dataset("merve/supersoaker-failures")
|
16 |
+
# df = df["train"].to_pandas()
|
17 |
+
|
18 |
+
def infer(input_dataframe):
|
19 |
+
return pd.DataFrame(model.predict(input_dataframe))
|
20 |
+
# examples = [[df.head(2)]]
|
21 |
+
gr.Interface(fn = infer, inputs = inputs, outputs = outputs).launch()
|