Skip to content

Instantly share code, notes, and snippets.

@lfoppiano lfoppiano/recipe.py
Created Mar 6, 2019

Embed
What would you like to do?
prodigy recipe
import prodigy
from prodigy.components.loaders import JSONL
from prodigy.util import split_string
@prodigy.recipe('superconductor-material-recipe',
dataset=prodigy.recipe_args['dataset'],
source=("The source data as a JSONL file", "positional", None, str),
label=("One or more comma-separated labels", "option", "l", split_string))
def superconductors_detection(dataset, source=None, label=None):
if source:
stream = JSONL(source)
# else:
# stream = add_options(stream)
def progress(session, total):
return total / 10000
return {
'dataset': dataset,
'view_id': 'ner_manual',
'stream': stream,
'config': {
'label': ', '.join(label) if label is not None else 'all',
'labels': label # Selectable label options
},
'progress': progress
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.