-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgcs.py
43 lines (35 loc) · 1.12 KB
/
gcs.py
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
import os
from os.path import join, dirname
from dotenv import load_dotenv
import scaleapi
load_dotenv(verbose=True)
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
API_TOKEN = os.environ.get("API_TOKEN")
client = scaleapi.ScaleClient(API_TOKEN)
## create project
# project = client.create_project(project_name="test_project_2", type="imageannotation", params = {
# "instruction": "This is a test project"
# })
# print(project)
## Create task
tasks = [
"gs://books-jp/bulksplash-ananogrey-HESw7t6aQqI.jpg",
"gs://books-jp/bulksplash-aquintero210-xvlzYmY3Tz8.jpg",
"gs://books-jp/bulksplash-artcoastdesign-oJ_5bY6KCag.jpg"
]
for task in tasks:
res = client.create_imageannotation_task(
project='test_project_2',
instruction="Draw a box around each baby cow and big cow.",
attachment_type="image",
attachment=task,
geometries={
"box": {
"objects_to_annotate": ["Engineer Book", "Social book"],
"min_height": 10,
"min_width": 10
}
}
)
print(res.status, res.response)