Spaces:
Runtime error
Runtime error
Update tasks/text.py
Browse files- tasks/text.py +6 -4
tasks/text.py
CHANGED
|
@@ -12,9 +12,6 @@ import joblib
|
|
| 12 |
REPO_ID = "kantundpeterpan/frugal-ai-toy"
|
| 13 |
FILENAME = "tfidf_rf.pkl"
|
| 14 |
|
| 15 |
-
model = joblib.load(
|
| 16 |
-
hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
|
| 17 |
-
)
|
| 18 |
|
| 19 |
import random
|
| 20 |
|
|
@@ -70,7 +67,12 @@ async def evaluate_text(request: TextEvaluationRequest):
|
|
| 70 |
# 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.
|
| 71 |
#--------------------------------------------------------------------------------------------
|
| 72 |
|
| 73 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
true_labels = test_dataset["label"]
|
| 75 |
predictions = [
|
| 76 |
LABEL_MAPPING[r] for r in model.predict(test_dataset)
|
|
|
|
| 12 |
REPO_ID = "kantundpeterpan/frugal-ai-toy"
|
| 13 |
FILENAME = "tfidf_rf.pkl"
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
import random
|
| 17 |
|
|
|
|
| 67 |
# 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.
|
| 68 |
#--------------------------------------------------------------------------------------------
|
| 69 |
|
| 70 |
+
#load model
|
| 71 |
+
model = joblib.load(
|
| 72 |
+
hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
# Make predictions
|
| 76 |
true_labels = test_dataset["label"]
|
| 77 |
predictions = [
|
| 78 |
LABEL_MAPPING[r] for r in model.predict(test_dataset)
|