Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,35 @@
|
|
1 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
gr.Interface.load("models/templates/tabular-classification").launch()
|
|
|
1 |
+
from huggingface_hub import hf_hub_url, cached_download
|
2 |
+
import joblib
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
REPO_ID = "julien-c/wine-quality"
|
6 |
+
FILENAME = "sklearn_model.joblib"
|
7 |
+
|
8 |
+
|
9 |
+
model = joblib.load(cached_download(
|
10 |
+
hf_hub_url(REPO_ID, FILENAME)
|
11 |
+
))
|
12 |
+
|
13 |
+
# model is a `sklearn.pipeline.Pipeline`
|
14 |
+
#GET SAMPLE DATA
|
15 |
+
data_file = cached_download(
|
16 |
+
hf_hub_url(REPO_ID, "winequality-red.csv")
|
17 |
+
)
|
18 |
+
df = pd.read_csv(dataset)
|
19 |
+
|
20 |
+
|
21 |
+
X = df.drop(["Target"], axis=1)
|
22 |
+
Y = df["Target"]
|
23 |
+
|
24 |
+
print(X[:3])
|
25 |
+
|
26 |
+
#GET PREDICTIONS
|
27 |
+
labels = model.predict(X[:3])
|
28 |
+
|
29 |
+
|
30 |
+
#EVALUATE
|
31 |
+
model.score(X, Y)
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
|
|