Texts
Attach text URLs
You can import texts to Text Projects by linking them from external storages. The linked texts are displayed in SuperAnnotate, but they aren't stored in our local servers. For that, you need to enable CORS in your storage or enable the CORS Unblock extension.
Enable CORS
Step 1: Enable CORS in your storage
Enable Cross-Origin Resource Sharing (CORS) for the storages you'll be using. See how.
Step 2: Create a CSV file containing the text URLs
Create a CSV file that contains the text URLs. Use this template CSV file as a reference.
Key | Required/Optional | Value |
---|---|---|
url | Required | Text URL |
name | Optional | Text name |
If the text name field is empty, a name ID will be generated based on the row ID and a random UUID.
Step 3: Attach text URLs via Python SDK
Attach the texts to your project with this SDK command.
sa.attach_items(
project = "Project Name",
attachments = "./text.csv",
annotation_status = "QualityCheck")
superannotatecli attach-document-urls --project “Project Name/Folder Name” --attachments “./documents.csv” --annotation_status “QualityCheck”
Enable the CORS Unblock extension
To use the Text Editor, you need to install and enable the CORS Unblock extension:
- Install the CORS Unblock extension.
- Pin the extension.
- When you go to the Text Editor, right-click on the extension.
- Hover over This Can Read and Change Site Data.
- Select the Text Editor’s link.
How to enable CORS
Amazon S3 bucket
- Go to your bucket.
- Go to Permissions.
- Turn off Block all public access.
- Insert this configuration in the CORS section:
[
{
"AllowedHeaders": [],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
}
]
- Click Save changes.
GCP storage
Learn how to configure CORS here on a GCP cloud storage bucket.
In Step 2 of the provided link, you need to use the gsutil cors
command to apply the configuration to your bucket. Find it below.
[
{
"origin": [
"https://*.superannotate.com"
],
"method": [
"GET"
],
"maxAgeSeconds": 3600
}
]
Azure blob storage
- Go to your Azure portal.
- Select Storage accounts.
- Go to your container.
- Under Settings, select Resource sharing (CORS).
- In the Blob service tab, set the values of these fields:
Allowed origins
:https://*.superannotate.com
Allowed methods
:GET
Max age
: preferred max age value in seconds. The value should be larger than 0. The standard value is 3600.
Upload texts from an integrated cloud storage
To upload texts from an integrated cloud storage:
sa.attach_items_from_integrated_storage(
project= "Project Name",
integration= {integration_meta},
folder_path= "storage_folder_name")
Learn how to create integrations.
Updated 12 months ago