Spaces:
Runtime error
Runtime error
Commit
·
5b1f749
1
Parent(s):
42ba4db
ready
Browse files- tasks/text.py +9 -8
tasks/text.py
CHANGED
@@ -3,9 +3,9 @@ from datetime import datetime
|
|
3 |
from datasets import load_dataset
|
4 |
from sklearn.metrics import accuracy_score
|
5 |
|
6 |
-
from skops import hub_utils
|
7 |
-
import skops.io as sio
|
8 |
import skops
|
|
|
|
|
9 |
|
10 |
import pandas as pd
|
11 |
|
@@ -89,14 +89,15 @@ async def evaluate_text(request: TextEvaluationRequest):
|
|
89 |
# Update the code below to replace the random baseline by your model inference within the inference pass where the energy consumption and emissions are tracked.
|
90 |
#--------------------------------------------------------------------------------------------
|
91 |
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
94 |
|
95 |
#load model
|
96 |
-
model =
|
97 |
-
hf_hub_download(repo_id=REPO_ID, filename=FILENAME),
|
98 |
-
trusted=unknown
|
99 |
-
)
|
100 |
|
101 |
# Make predictions
|
102 |
true_labels = test_dataset["label"]
|
|
|
3 |
from datasets import load_dataset
|
4 |
from sklearn.metrics import accuracy_score
|
5 |
|
|
|
|
|
6 |
import skops
|
7 |
+
from skops.hub_utils import download
|
8 |
+
from skops.io import load
|
9 |
|
10 |
import pandas as pd
|
11 |
|
|
|
89 |
# Update the code below to replace the random baseline by your model inference within the inference pass where the energy consumption and emissions are tracked.
|
90 |
#--------------------------------------------------------------------------------------------
|
91 |
|
92 |
+
test_df = pd.DataFrame(dataset['test'])
|
93 |
+
|
94 |
+
#download model
|
95 |
+
download(repo_id = "kantundpeterpan/frugal-ai-toy", dst = "skops_test")
|
96 |
+
#get unknwown types
|
97 |
+
unknown = skops.io.get_untrusted_types(file = "skops_test/tfidf_rf.skops")
|
98 |
|
99 |
#load model
|
100 |
+
model = model = load("skops_test/tfidf_rf.skops", trusted = unknown)
|
|
|
|
|
|
|
101 |
|
102 |
# Make predictions
|
103 |
true_labels = test_dataset["label"]
|