Charles95 hogepodge commited on
Commit
b4a7291
Β·
0 Parent(s):

Duplicate from LabelStudio/LabelStudio

Browse files

Co-authored-by: Chris Hoge <hogepodge@users.noreply.huggingface.co>

Files changed (3) hide show
  1. .gitattributes +34 -0
  2. Dockerfile +136 -0
  3. README.md +179 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM heartexlabs/label-studio:hf-latest
2
+
3
+ ################################################################################
4
+ #
5
+ # How to Disable Public Account Creation
6
+ # --------------------------------------
7
+ # By default this space allows for the unrestricted creation of new accounts
8
+ # will full access to all projects and data. This is great for trying out
9
+ # Label Studio and collaborating on projects, but you may want to restrict
10
+ # access to your space to only authorized users. Uncomment the following line
11
+ # to disable public account creation for this space.
12
+ #
13
+ # ENV LABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK=true
14
+ #
15
+ # Set secrets in your space to create an inital user, and log in with your
16
+ # provided username and password. Do not set these in your Dockerfile, as they
17
+ # globally visible on a public space.
18
+ #
19
+ # LABEL_STUDIO_USERNAME
20
+ # LABEL_STUDIO_PASSWORD
21
+ #
22
+ # You will need to provide new users with an invitation link to join the space.
23
+ #
24
+ ################################################################################
25
+
26
+ ################################################################################
27
+ #
28
+ # How to Enable Persistent Storage for Label Studio in Hugging Face Spaces
29
+ # ------------------------------------------------------------------------
30
+ #
31
+ # By default this space stores all project configuration and data annotations
32
+ # in local storage with sqlite. If the space is reset, all configuration and
33
+ # annotation data in the space will be lost. You can enable configuration
34
+ # persistence through one of two methods:
35
+ #
36
+ # 1) Attaching an HF Storage Bucket for persisting the SQLite database and
37
+ # media uploads across restarts (recommended).
38
+ # 2) Connecting an external Postgres database for saving project and annotation
39
+ # settings, and cloud by connecting cloud storage for tasks.
40
+ #
41
+ ################################################################################
42
+
43
+ ################################################################################
44
+ #
45
+ # How to Enable Persistence with HF Storage Buckets
46
+ # --------------------------------------------------
47
+ #
48
+ # HF Storage Buckets provide persistent object storage that can be
49
+ # mounted directly into your Space. Label Studio will write its SQLite
50
+ # database and media uploads into the mounted bucket, so everything
51
+ # survives restarts.
52
+ #
53
+ # 1. Create a bucket: hf buckets create <namespace>/label-studio-data
54
+ # 2. Attach it in Space Settings β†’ Storage Buckets, mount path: /data
55
+ # 3. Set Space Variables:
56
+ # LABEL_STUDIO_BASE_DATA_DIR=/data
57
+ # STORAGE_PERSISTENCE=1
58
+ # 4. (Recommended) Set a SECRET_KEY Space Secret to keep user sessions
59
+ # alive across restarts.
60
+ # 5. Factory rebuild the Space.
61
+ #
62
+ # See https://huggingface.co/docs/hub/storage-buckets for more details.
63
+ #
64
+ ################################################################################
65
+
66
+ ################################################################################
67
+ #
68
+ # How to Enable Configuration Persistence with Postgres
69
+ # -----------------------------------------------------
70
+ #
71
+ # Set the following secret variables to match your own hosted instance of
72
+ # Postgres. We strongly recommend setting these as secrets to prevent leaking
73
+ # information about your database service to the public in your spaces
74
+ # definition.
75
+ #
76
+ # ENV DJANGO_DB=default
77
+ # ENV POSTGRE_NAME=<postgres_name>
78
+ # ENV POSTGRE_PORT=<db_port>
79
+ # ENV POSTGRE_USER=<postgres_user>
80
+ # ENV POSTGRE_PASSWORD=<password>
81
+ # ENV POSTGRE_PORT=<db_port>
82
+ # ENV POSTGRE_HOST=<db_host>
83
+ #
84
+ # Uncomment the following line or set the following Space variable to remove
85
+ # the warning about ephemeral storage
86
+ #
87
+ # ENV STORAGE_PERSISTENCE=1
88
+ #
89
+ # Note that you will need to connect cloud storage to host data items that you
90
+ # want to annotate, as local storage will not be preserved across a space reset.
91
+ #
92
+ #
93
+ # How to Enable Cloud Storage
94
+ # ---------------------------
95
+ # By default the only data storage enabled for this space is local. In the case
96
+ # of a space reset, all data will be lost. To enable permanent storage, you
97
+ # must enable a cloud storage connector. We also strongly recommend enabling
98
+ # configuration persistence to preserve project data, annotations, and user
99
+ # settings. Choose the appropriate cloud connector and configure the secrets
100
+ # for it.
101
+ #
102
+ # Amazon S3
103
+ # =========
104
+ # STORAGE_TYPE=s3
105
+ # STORAGE_AWS_ACCESS_KEY_ID="<YOUR_ACCESS_KEY_ID>"
106
+ # STORAGE_AWS_SECRET_ACCESS_KEY="<YOUR_SECRET_ACCESS_KEY>"
107
+ # STORAGE_AWS_BUCKET_NAME="<YOUR_BUCKET_NAME>"
108
+ # STORAGE_AWS_REGION_NAME="<YOUR_BUCKET_REGION>"
109
+ # STORAGE_AWS_FOLDER=""
110
+ #
111
+ # Google Cloud Storage
112
+ # ====================
113
+ #
114
+ # STORAGE_TYPE=gcs
115
+ # STORAGE_GCS_BUCKET_NAME="<YOUR_BUCKET_NAME>"
116
+ # STORAGE_GCS_PROJECT_ID="<YOUR_PROJECT_ID>"
117
+ # STORAGE_GCS_FOLDER=""
118
+ # GOOGLE_APPLICATION_CREDENTIALS="/opt/heartex/secrets/key.json"
119
+ #
120
+ # Azure Blob Storage
121
+ # ==================
122
+ #
123
+ # STORAGE_TYPE=azure
124
+ # STORAGE_AZURE_ACCOUNT_NAME="<YOUR_STORAGE_ACCOUNT>"
125
+ # STORAGE_AZURE_ACCOUNT_KEY="<YOUR_STORAGE_KEY>"
126
+ # STORAGE_AZURE_CONTAINER_NAME="<YOUR_CONTAINER_NAME>"
127
+ # STORAGE_AZURE_FOLDER=""
128
+ #
129
+ ################################################################################
130
+
131
+ # The upstream base image runs as UID 1001. HF Storage Bucket mounts currently
132
+ # require root to write. This can be removed once bucket mounts support
133
+ # non-root UIDs natively.
134
+ USER root
135
+
136
+ CMD exec label-studio --host=$SPACE_HOST
README.md ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: LabelStudio
3
+ emoji: 🟧
4
+ colorFrom: yellow
5
+ colorTo: purple
6
+ sdk: docker
7
+ tags:
8
+ - label-studio
9
+ fullwidth: true
10
+ license: apache-2.0
11
+ app_port: 8080
12
+ ---
13
+ <img src="https://user-images.githubusercontent.com/12534576/192582340-4c9e4401-1fe6-4dbb-95bb-fdbba5493f61.png"/>
14
+
15
+ [Website](https://hubs.ly/Q01CNgsd0) β€’ [Docs](https://hubs.ly/Q01CN9Yq0) β€’ [12K+ GitHub ⭐️!](https://hubs.ly/Q01CNbPQ0) β€’ [Slack Community](https://hubs.ly/Q01CNb9H0)
16
+
17
+ ## What is Label Studio?
18
+
19
+ Label Studio is an open source data labeling platform. It lets you label audio,
20
+ text, images, videos, and time series data with a simple, straightforward, and
21
+ highly-configurable user interface. Label Studio can prepare new data or
22
+ improve existing training data to get more accurate ML models.
23
+
24
+
25
+ ## Label Studio in Hugging Face Spaces
26
+
27
+ The Label Studio community is thrilled to offer Label Studio as a Hugging Face
28
+ Spaces application. You can try the data-annotation interface, connect popular
29
+ machine learning models, and share the application with collaborators. You can
30
+ start immediately by creating an account or replicate the space and work in
31
+ your own environment.
32
+
33
+ ## Creating a Use Account and Logging In
34
+
35
+ Begin by creating a new account in the Label Studio space, then log in with your
36
+ credentials.
37
+
38
+ **By default, these spaces permit anyone to create a new login
39
+ account, allowing them to view and modify project configuration, data sets, and
40
+ annotations. Without any modifications, treat this space like a demo environment.**
41
+
42
+ ## Creating a Labeling Project
43
+
44
+ After logging in, Label Studio will present you with a project view. Here you
45
+ can create a new project with prompts to upload data and set up a custom
46
+ configuration interface.
47
+
48
+ **Note that in the default configuration, storage is local and temporary.** To
49
+ persist your projects and annotations across restarts, attach an
50
+ [HF Storage Bucket](https://huggingface.co/docs/hub/storage-buckets) β€” see the
51
+ persistence section below.
52
+
53
+ ## Next Steps and Additional Resources
54
+
55
+ To help with getting started, the Label Studio community curated a list of
56
+ resources including tutorials and documentation.
57
+
58
+ - πŸš€ [Zero to One with Label Studio Tutorial](https://labelstud.io/blog/introduction-to-label-studio-in-hugging-face-spaces/)
59
+ - πŸ“ˆ [Try Label Studio Enterprise](https://hubs.ly/Q01CMLll0)
60
+ - πŸ€— [Tutorial: Using Label Studio with Hugging Face Datasets Hub](https://danielvanstrien.xyz/huggingface/huggingface-datasets/annotation/full%20stack%20deep%20learning%20notes/2022/09/07/label-studio-annotations-hub.html)
61
+ - πŸ’‘ [Label Studio Docs](https://hubs.ly/Q01CN9Yq0)
62
+
63
+
64
+ ![Gif of Label Studio annotating different types of data](https://raw.githubusercontent.com/heartexlabs/label-studio/master/images/annotation_examples.gif)
65
+
66
+ ### Making your Label Studio Hugging Face Space production-ready
67
+
68
+ By default this space allows for the unrestricted creation of new accounts
69
+ will full access to all projects and data. This is great for trying out
70
+ Label Studio and collaborating on projects, but you may want to restrict
71
+ access to your space to only authorized users. Add the following environment
72
+ variable to your spaces Dockerfile to disable public account creation for
73
+ this space.
74
+
75
+ ENV LABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK=true
76
+
77
+ Set secrets in your space to create an inital user, and log in with your
78
+ provided username and password. Do not set these in your Dockerfile, as they
79
+ globally visible on a public space.
80
+
81
+ LABEL_STUDIO_USERNAME
82
+ LABEL_STUDIO_PASSWORD
83
+
84
+ You will need to provide new users with an invitation link to join the space,
85
+ which can be found in the Organizations interface of Label Studio.
86
+
87
+ By default this space stores all project configuration and data annotations
88
+ in local storage with SQLite. If the space is reset, all configuration and
89
+ annotation data in the space will be lost. You can enable persistence in one
90
+ of two ways:
91
+
92
+ 1. Attaching an HF Storage Bucket (recommended).
93
+
94
+ 2. Connecting an external Postgres database and cloud storage to your space,
95
+ guaranteeing that all project and annotation settings are preserved.
96
+
97
+ ### Persistence with HF Storage Buckets
98
+
99
+ [HF Storage Buckets](https://huggingface.co/docs/hub/storage-buckets) provide
100
+ persistent object storage that can be mounted directly into your Space. Label
101
+ Studio will write its SQLite database and media uploads into the mounted bucket,
102
+ so projects and annotations survive restarts.
103
+
104
+ 1. **Create a bucket:**
105
+
106
+ hf buckets create <your-namespace>/label-studio-data
107
+
108
+ 2. **Attach it** in Space Settings β†’ Storage Buckets, mount path `/data`.
109
+
110
+ 3. **Set two Space Variables:**
111
+
112
+ LABEL_STUDIO_BASE_DATA_DIR=/data
113
+ STORAGE_PERSISTENCE=1
114
+
115
+ 4. **Factory rebuild** the Space.
116
+
117
+ It is also recommended to set a `SECRET_KEY` Space Secret to keep user sessions
118
+ alive across restarts. Without it, Label Studio generates a random key on each
119
+ boot and all users are logged out on restart.
120
+
121
+ ### Enabling Postgres Database and Cloud Storage
122
+
123
+ Set the following secret variables to match your own hosted instance of
124
+ Postgres. We strongly recommend setting these as secrets to prevent leaking
125
+ information about your database service to the public in your spaces
126
+ definition.
127
+
128
+ DJANGO_DB=default
129
+ POSTGRE_NAME=<postgres_name>
130
+ POSTGRE_PORT=<db_port>
131
+ POSTGRE_USER=<postgres_user>
132
+ POSTGRE_PASSWORD=<password>
133
+ POSTGRE_PORT=<db_port>
134
+ POSTGRE_HOST=<db_host>
135
+
136
+ Add the following environment variable to remove the warning about ephemeral
137
+ storage.
138
+
139
+ ENV STORAGE_PERSISTENCE=1
140
+
141
+ Note that you will need to connect cloud storage to host data items that you
142
+ want to annotate, as local storage will not be preserved across a space reset.
143
+
144
+ By default the only data storage enabled for this space is local. In the case
145
+ of a space reset, all data will be lost. To enable permanent storage, you
146
+ must enable a cloud storage connector. We also strongly recommend enabling
147
+ configuration persistence to preserve project data, annotations, and user
148
+ settings. Choose the appropriate cloud connector and configure the secrets
149
+ for it.
150
+
151
+ #### Amazon S3
152
+ STORAGE_TYPE=s3
153
+ STORAGE_AWS_ACCESS_KEY_ID="<YOUR_ACCESS_KEY_ID>"
154
+ STORAGE_AWS_SECRET_ACCESS_KEY="<YOUR_SECRET_ACCESS_KEY>"
155
+ STORAGE_AWS_BUCKET_NAME="<YOUR_BUCKET_NAME>"
156
+ STORAGE_AWS_REGION_NAME="<YOUR_BUCKET_REGION>"
157
+ STORAGE_AWS_FOLDER=""
158
+
159
+ #### Google Cloud Storage
160
+
161
+ STORAGE_TYPE=gcs
162
+ STORAGE_GCS_BUCKET_NAME="<YOUR_BUCKET_NAME>"
163
+ STORAGE_GCS_PROJECT_ID="<YOUR_PROJECT_ID>"
164
+ STORAGE_GCS_FOLDER=""
165
+ GOOGLE_APPLICATION_CREDENTIALS="/opt/heartex/secrets/key.json"
166
+
167
+ Azure Blob Storage
168
+ ==================
169
+
170
+ STORAGE_TYPE=azure
171
+ STORAGE_AZURE_ACCOUNT_NAME="<YOUR_STORAGE_ACCOUNT>"
172
+ STORAGE_AZURE_ACCOUNT_KEY="<YOUR_STORAGE_KEY>"
173
+ STORAGE_AZURE_CONTAINER_NAME="<YOUR_CONTAINER_NAME>"
174
+ STORAGE_AZURE_FOLDER=""
175
+
176
+
177
+ ## Questions? Concerns? Want to get involved?
178
+
179
+ Email the community team at [community@labelstud.io](mailto:community@labelstud.io)