Spaces:
Runtime error
Runtime error
File size: 1,177 Bytes
2de8479 d744208 2de8479 d744208 2de8479 0b54318 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
def get_display_only_data():
data1 = {
"tokens": [
{"text": "He", "labels": ["Person"]},
{"text": "loves"},
{"text": "his"},
{"text": "dog", "labels": ["Animal", "Pet"]},
],
"labels": [
{"text": "Person"},
{"text": "Action"},
{"text": "Animal"},
]
}
return data1
def get_editable_data():
data2 = {
"allowEditing": True,
"tokens": [
{"text": "He", "labels": ["Pronoun", "Person"]},
{"text": "loves", "labels": ["Action"]},
{"text": "his"},
{"text": "dog", "labels": ["Animal"]},
],
"labels": [
{"text": "Pronoun", "style": {
"color": "red",
"background-color": "white",
"font-size": "8px",
"border": "3px dashed red",
}},
{"text": "Verb", "style": {
"color": "green",
"background-color": "white",
"font-size": "8px",
"font-weight": "900",
}},
{"text": "Noun", "style": {
"color": "blue",
"background-color": "white",
"font-size": "8px",
}},
{"text": "Person"},
{"text": "Animal"},
]
}
return data2 |