You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
578 B
Python
22 lines
578 B
Python
import datasets
|
|
|
|
from benchmarks.overall.methods import BaseMethod, BenchmarkResult
|
|
|
|
|
|
class MathpixMethod(BaseMethod):
|
|
mathpix_ds: datasets.Dataset = None
|
|
|
|
def __call__(self, sample) -> BenchmarkResult:
|
|
uuid = sample["uuid"]
|
|
data = None
|
|
for row in self.mathpix_ds:
|
|
if str(row["uuid"]) == str(uuid):
|
|
data = row
|
|
break
|
|
if not data:
|
|
raise ValueError(f"Could not find data for uuid {uuid}")
|
|
|
|
return {
|
|
"markdown": data["md"],
|
|
"time": data["time"]
|
|
} |