Spaces:
Runtime error
Runtime error
Commit
·
4c3f9ef
0
Parent(s):
Duplicate from scikit-learn/tabular-playground
Browse filesCo-authored-by: Merve Noyan <[email protected]>
- .gitattributes +31 -0
- README.md +14 -0
- app.py +33 -0
- config.json +159 -0
- model.pkl +3 -0
- requirements.txt +2 -0
.gitattributes
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
23 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Tabular Playground
|
3 |
+
emoji: 👁
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: yellow
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.20.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
+
duplicated_from: scikit-learn/tabular-playground
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sklearn
|
2 |
+
import gradio as gr
|
3 |
+
import joblib
|
4 |
+
import pandas as pd
|
5 |
+
import datasets
|
6 |
+
|
7 |
+
pipe = joblib.load("./model.pkl")
|
8 |
+
|
9 |
+
title = "Supersoaker Defective Product Prediction"
|
10 |
+
description = "This model predicts Supersoaker production line failures. Drag and drop any slice from dataset or edit values as you wish in below dataframe component."
|
11 |
+
|
12 |
+
|
13 |
+
with open("./config.json") as f:
|
14 |
+
config_dict = eval(f.read())
|
15 |
+
headers = config_dict["sklearn"]["columns"]
|
16 |
+
|
17 |
+
df = datasets.load_dataset("merve/supersoaker-failures")
|
18 |
+
df = df["train"].to_pandas()
|
19 |
+
df.dropna(axis=0, inplace=True)
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
inputs = [gr.Dataframe(headers = headers, row_count = (2, "dynamic"), col_count=(24,"dynamic"), label="Input Data", interactive=1)]
|
24 |
+
outputs = [gr.Dataframe(row_count = (2, "dynamic"), col_count=(1, "fixed"), label="Predictions", headers=["Failures"])]
|
25 |
+
|
26 |
+
|
27 |
+
def infer(inputs):
|
28 |
+
data = pd.DataFrame(inputs, columns=headers)
|
29 |
+
predictions = pipe.predict(inputs)
|
30 |
+
return pd.DataFrame(predictions, columns=["results"])
|
31 |
+
|
32 |
+
gr.Interface(infer, inputs = inputs, outputs = outputs, title = title,
|
33 |
+
description = description, examples=[df.head(3)], cache_examples=False).launch(debug=True)
|
config.json
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"sklearn": {
|
3 |
+
"columns": [
|
4 |
+
"product_code",
|
5 |
+
"loading",
|
6 |
+
"attribute_0",
|
7 |
+
"attribute_1",
|
8 |
+
"attribute_2",
|
9 |
+
"attribute_3",
|
10 |
+
"measurement_0",
|
11 |
+
"measurement_1",
|
12 |
+
"measurement_2",
|
13 |
+
"measurement_3",
|
14 |
+
"measurement_4",
|
15 |
+
"measurement_5",
|
16 |
+
"measurement_6",
|
17 |
+
"measurement_7",
|
18 |
+
"measurement_8",
|
19 |
+
"measurement_9",
|
20 |
+
"measurement_10",
|
21 |
+
"measurement_11",
|
22 |
+
"measurement_12",
|
23 |
+
"measurement_13",
|
24 |
+
"measurement_14",
|
25 |
+
"measurement_15",
|
26 |
+
"measurement_16",
|
27 |
+
"measurement_17"
|
28 |
+
],
|
29 |
+
"environment": [
|
30 |
+
"scikit-learn=1.0.2"
|
31 |
+
],
|
32 |
+
"example_input": {
|
33 |
+
"attribute_0": [
|
34 |
+
"material_7",
|
35 |
+
"material_7",
|
36 |
+
"material_7"
|
37 |
+
],
|
38 |
+
"attribute_1": [
|
39 |
+
"material_8",
|
40 |
+
"material_8",
|
41 |
+
"material_6"
|
42 |
+
],
|
43 |
+
"attribute_2": [
|
44 |
+
5,
|
45 |
+
5,
|
46 |
+
6
|
47 |
+
],
|
48 |
+
"attribute_3": [
|
49 |
+
8,
|
50 |
+
8,
|
51 |
+
9
|
52 |
+
],
|
53 |
+
"loading": [
|
54 |
+
154.02,
|
55 |
+
108.73,
|
56 |
+
99.84
|
57 |
+
],
|
58 |
+
"measurement_0": [
|
59 |
+
14,
|
60 |
+
4,
|
61 |
+
6
|
62 |
+
],
|
63 |
+
"measurement_1": [
|
64 |
+
6,
|
65 |
+
7,
|
66 |
+
7
|
67 |
+
],
|
68 |
+
"measurement_10": [
|
69 |
+
16.637,
|
70 |
+
16.207,
|
71 |
+
17.17
|
72 |
+
],
|
73 |
+
"measurement_11": [
|
74 |
+
20.719,
|
75 |
+
20.058,
|
76 |
+
20.858
|
77 |
+
],
|
78 |
+
"measurement_12": [
|
79 |
+
12.824,
|
80 |
+
11.898,
|
81 |
+
10.968
|
82 |
+
],
|
83 |
+
"measurement_13": [
|
84 |
+
16.067,
|
85 |
+
13.871,
|
86 |
+
16.448
|
87 |
+
],
|
88 |
+
"measurement_14": [
|
89 |
+
15.181,
|
90 |
+
14.266,
|
91 |
+
15.6
|
92 |
+
],
|
93 |
+
"measurement_15": [
|
94 |
+
18.546,
|
95 |
+
15.734,
|
96 |
+
14.637
|
97 |
+
],
|
98 |
+
"measurement_16": [
|
99 |
+
19.402,
|
100 |
+
16.886,
|
101 |
+
13.86
|
102 |
+
],
|
103 |
+
"measurement_17": [
|
104 |
+
643.086,
|
105 |
+
642.533,
|
106 |
+
673.545
|
107 |
+
],
|
108 |
+
"measurement_2": [
|
109 |
+
6,
|
110 |
+
9,
|
111 |
+
6
|
112 |
+
],
|
113 |
+
"measurement_3": [
|
114 |
+
19.532,
|
115 |
+
18.128,
|
116 |
+
"NaN"
|
117 |
+
],
|
118 |
+
"measurement_4": [
|
119 |
+
11.017,
|
120 |
+
11.866,
|
121 |
+
10.064
|
122 |
+
],
|
123 |
+
"measurement_5": [
|
124 |
+
15.639,
|
125 |
+
17.891,
|
126 |
+
16.287
|
127 |
+
],
|
128 |
+
"measurement_6": [
|
129 |
+
16.709,
|
130 |
+
20.302,
|
131 |
+
17.445
|
132 |
+
],
|
133 |
+
"measurement_7": [
|
134 |
+
10.057,
|
135 |
+
"NaN",
|
136 |
+
12.117
|
137 |
+
],
|
138 |
+
"measurement_8": [
|
139 |
+
20.201,
|
140 |
+
18.148,
|
141 |
+
20.659
|
142 |
+
],
|
143 |
+
"measurement_9": [
|
144 |
+
11.106,
|
145 |
+
10.221,
|
146 |
+
11.999
|
147 |
+
],
|
148 |
+
"product_code": [
|
149 |
+
"C",
|
150 |
+
"C",
|
151 |
+
"E"
|
152 |
+
]
|
153 |
+
},
|
154 |
+
"model": {
|
155 |
+
"file": "model.pkl"
|
156 |
+
},
|
157 |
+
"task": "tabular-classification"
|
158 |
+
}
|
159 |
+
}
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:84098fd909f038f50921180fa9fa322a5df1728fe9bbea2bcc971fc88232ea81
|
3 |
+
size 6824
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
scikit-learn==1.0.2
|
2 |
+
pandas
|