Spaces:
Runtime error
Runtime error
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 |