annotation update
This commit is contained in:
parent
96e378fd77
commit
1db9bd33cb
|
@ -13,7 +13,8 @@ def process_line(line):
|
|||
"type": "TextualBody",
|
||||
"value": folder_name,
|
||||
"format": "text/html",
|
||||
"language": "en"
|
||||
"language": "en",
|
||||
"tag": folder_name
|
||||
}],
|
||||
"target": {
|
||||
"selector": {
|
||||
|
@ -28,12 +29,12 @@ def process_line(line):
|
|||
return annotation
|
||||
|
||||
annotations = []
|
||||
with open('../image.txt', 'r') as file:
|
||||
with open('image.txt', 'r') as file:
|
||||
lines = file.readlines()
|
||||
for line in lines:
|
||||
annotations.append(process_line(line))
|
||||
|
||||
with open('../../annotations/annotations.w3c.json', 'w') as output_file:
|
||||
with open('../annotations/annotations.w3c.json', 'w') as output_file:
|
||||
json.dump(annotations, output_file, indent=2)
|
||||
|
||||
print("Annotations JSON file created.")
|
||||
|
|
|
@ -18,15 +18,14 @@ function sendMessageToServer(message) {
|
|||
}
|
||||
|
||||
anno.on('clickAnnotation', async function(annotation) {
|
||||
let annotationText = annotation.body[0].value;
|
||||
let annotationValue = annotation.body[0].tag;
|
||||
|
||||
if (!annotationText.includes("sketchersunited.org/")) {
|
||||
try {
|
||||
let newAnnotation = annotation;
|
||||
newAnnotation.body[0].value = "🔁 Downloading label...";
|
||||
anno.updateSelected(newAnnotation);
|
||||
|
||||
let response = await sendMessageToServer(annotationText);
|
||||
let response = await sendMessageToServer(annotationValue);
|
||||
|
||||
let trueValueAnnotation = newAnnotation;
|
||||
|
||||
|
@ -43,5 +42,5 @@ anno.on('clickAnnotation', async function(annotation) {
|
|||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue