Spaces:
Sleeping
Sleeping
test
Browse files- app.py +0 -3
- top5_error_rate.py +2 -0
app.py
CHANGED
@@ -10,13 +10,10 @@ metric = evaluate.load("Aye10032/top5_error_rate")
|
|
10 |
|
11 |
|
12 |
def compute(data):
|
13 |
-
print(data)
|
14 |
-
# return metric.compute()
|
15 |
result = {
|
16 |
"predictions": [list(map(float, pred.split(","))) for pred in data["predictions"]],
|
17 |
"references": data["references"].cast(pl.Int64).to_list()
|
18 |
}
|
19 |
-
print(result)
|
20 |
return metric.compute(**result)
|
21 |
|
22 |
|
|
|
10 |
|
11 |
|
12 |
def compute(data):
|
|
|
|
|
13 |
result = {
|
14 |
"predictions": [list(map(float, pred.split(","))) for pred in data["predictions"]],
|
15 |
"references": data["references"].cast(pl.Int64).to_list()
|
16 |
}
|
|
|
17 |
return metric.compute(**result)
|
18 |
|
19 |
|
top5_error_rate.py
CHANGED
@@ -63,6 +63,8 @@ class Top5ErrorRate(evaluate.Metric):
|
|
63 |
references: list[int] = None,
|
64 |
**kwargs,
|
65 |
) -> Dict[str, Any]:
|
|
|
|
|
66 |
# to numpy array
|
67 |
outputs = np.array(predictions, dtype=np.float32)
|
68 |
labels = np.array(references)
|
|
|
63 |
references: list[int] = None,
|
64 |
**kwargs,
|
65 |
) -> Dict[str, Any]:
|
66 |
+
print(predictions)
|
67 |
+
print(references)
|
68 |
# to numpy array
|
69 |
outputs = np.array(predictions, dtype=np.float32)
|
70 |
labels = np.array(references)
|