I have done more testing to identify potential cause. The following code (based on a previous question) causes Uncaught (in promise) TypeError: Window.fetch: data:audio/mp3;base64
in Firefox. However, there was no error in Google Chrome. Is there a known issue for fetch_media
in Firefox?
# the recipe audio_multiple_options.py
from pathlib import Path
from typing import Union
import jinja2
import prodigy
from prodigy import set_hashes
from prodigy.components.preprocess import \
fetch_media as fetch_media_preprocessor
from prodigy.components.stream import get_stream
from prodigy.util import msg
@prodigy.recipe(
"multiple.choice",
dataset=("The dataset to use", "positional", None, str),
source=("The source data as a JSONL file", "positional", None, str),
)
def multiple_choice(
dataset: str,
source: str,
):
stream = get_stream(source, loader="jsonl", input_key="audio")
stream.apply(fetch_media_preprocessor, input_keys=["audio", "video"])
labels = ["Label1", "Label2", "Label3"]
def add_template(stream, labels):
for ex in stream:
yield set_hashes(ex)
# custom_js = Path("custom.js").read_text()
def before_db(examples):
for ex in examples:
del ex["html"]
if "audio" in ex and ex["audio"].startswith("data:") and "path" in ex:
ex["audio"] = ex["path"]
return examples
return {
"view_id": "blocks",
"dataset": dataset, # Name of dataset to save annotations
"stream": add_template(stream, labels), # Incoming stream of examples
"config": {
"blocks": [
{"view_id": "audio"},
{"view_id": "html"},
],
},
"before_db": before_db,
}
I used the following .jsonl
file for testing:
{"audio": "/tmp/test.mp3"}