Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"🟧 Label Studio on Spaces","local":"-label-studio-on-spaces","sections":[{"title":"⚡️ Deploy Label Studio on Spaces","local":"-deploy-label-studio-on-spaces","sections":[],"depth":2},{"title":"🚀 Using the Default Configuration","local":"-using-the-default-configuration","sections":[],"depth":2},{"title":"🛠️ Configuring a Production-Ready Instance of Label Studio","local":"-configuring-a-production-ready-instance-of-label-studio","sections":[{"title":"Disable Unrestricted Creation of New Accounts","local":"disable-unrestricted-creation-of-new-accounts","sections":[],"depth":3},{"title":"Enable Persistence with HF Storage Buckets","local":"enable-persistence-with-hf-storage-buckets","sections":[{"title":"Have a coding agent do it for you","local":"have-a-coding-agent-do-it-for-you","sections":[],"depth":4}],"depth":3},{"title":"Enable Persistence with Postgres","local":"enable-persistence-with-postgres","sections":[],"depth":3},{"title":"Enable Cloud Storage","local":"enable-cloud-storage","sections":[{"title":"Amazon S3","local":"amazon-s3","sections":[],"depth":4},{"title":"Google Cloud Storage","local":"google-cloud-storage","sections":[],"depth":4},{"title":"Azure Blob Storage","local":"azure-blob-storage","sections":[],"depth":4}],"depth":3}],"depth":2},{"title":"🤗 Next Steps, Feedback, and Support","local":"-next-steps-feedback-and-support","sections":[],"depth":2}],"depth":1}"> | |
| <link href="/docs/hub/pr_2521/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/entry/start.d19e5ca7.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/chunks/scheduler.409792a1.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/chunks/singletons.1ece723a.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/chunks/index.0f0d9f26.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/chunks/paths.a67d9216.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/entry/app.98ab229a.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/chunks/preload-helper.78e52d9f.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/chunks/index.92d389ff.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/nodes/0.7799902b.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/nodes/221.fc712ffb.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/chunks/CopyLLMTxtMenu.dcf7fb47.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.0c189c7e.js"> | |
| <link rel="modulepreload" href="/docs/hub/pr_2521/en/_app/immutable/chunks/CodeBlock.5ed269c1.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"🟧 Label Studio on Spaces","local":"-label-studio-on-spaces","sections":[{"title":"⚡️ Deploy Label Studio on Spaces","local":"-deploy-label-studio-on-spaces","sections":[],"depth":2},{"title":"🚀 Using the Default Configuration","local":"-using-the-default-configuration","sections":[],"depth":2},{"title":"🛠️ Configuring a Production-Ready Instance of Label Studio","local":"-configuring-a-production-ready-instance-of-label-studio","sections":[{"title":"Disable Unrestricted Creation of New Accounts","local":"disable-unrestricted-creation-of-new-accounts","sections":[],"depth":3},{"title":"Enable Persistence with HF Storage Buckets","local":"enable-persistence-with-hf-storage-buckets","sections":[{"title":"Have a coding agent do it for you","local":"have-a-coding-agent-do-it-for-you","sections":[],"depth":4}],"depth":3},{"title":"Enable Persistence with Postgres","local":"enable-persistence-with-postgres","sections":[],"depth":3},{"title":"Enable Cloud Storage","local":"enable-cloud-storage","sections":[{"title":"Amazon S3","local":"amazon-s3","sections":[],"depth":4},{"title":"Google Cloud Storage","local":"google-cloud-storage","sections":[],"depth":4},{"title":"Azure Blob Storage","local":"azure-blob-storage","sections":[],"depth":4}],"depth":3}],"depth":2},{"title":"🤗 Next Steps, Feedback, and Support","local":"-next-steps-feedback-and-support","sections":[],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg></button></div> </div> <h1 class="relative group"><a id="-label-studio-on-spaces" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#-label-studio-on-spaces"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>🟧 Label Studio on Spaces</span></h1> <p data-svelte-h="svelte-1rv0u62"><a href="https://labelstud.io" rel="nofollow">Label Studio</a> is an <a href="https://github.com/heartexlabs/label-studio" rel="nofollow">open-source data labeling | |
| platform</a> for labeling, | |
| annotating, and exploring many different data types. Additionally, Label Studio | |
| includes a powerful <a href="https://labelstud.io/guide/ml.html" rel="nofollow">machine learning | |
| interface</a> that can be used for new model | |
| training, active learning, supervised learning, and many other training | |
| techniques.</p> <p data-svelte-h="svelte-hmjd3t">This guide will teach you how to deploy Label Studio for data | |
| labeling and annotation within the Hugging Face Hub. You can use the default | |
| configuration of Label Studio as a self-contained application hosted completely | |
| on the Hub using Docker for demonstration and evaluation purposes, or you can | |
| attach your own database and cloud storage to host a fully-featured | |
| production-ready application hosted on Spaces.</p> <h2 class="relative group"><a id="-deploy-label-studio-on-spaces" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#-deploy-label-studio-on-spaces"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>⚡️ Deploy Label Studio on Spaces</span></h2> <p data-svelte-h="svelte-1wl7hvq">You can deploy Label Studio on Spaces with just a few clicks:</p> <a href="https://huggingface.co/new-space?template=LabelStudio/LabelStudio" data-svelte-h="svelte-q39mm4"><img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/deploy-to-spaces-lg.svg"></a> <p data-svelte-h="svelte-zf4u24">Spaces requires you to define:</p> <ul data-svelte-h="svelte-s4n4yw"><li><p>An <strong>Owner</strong>: either your personal account or an organization you’re a | |
| part of.</p></li> <li><p>A <strong>Space name</strong>: the name of the Space within the account | |
| you’re creating the Space.</p></li> <li><p>The <strong>Visibility</strong>: <em>private</em> if you want the | |
| Space to be visible only to you or your organization, or <em>public</em> if you want | |
| it to be visible to other users or applications using the Label Studio API | |
| (suggested).</p></li></ul> <h2 class="relative group"><a id="-using-the-default-configuration" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#-using-the-default-configuration"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>🚀 Using the Default Configuration</span></h2> <p data-svelte-h="svelte-8oph0w">By default, Label Studio is installed in Spaces with a configuration that uses | |
| local storage for the application database to store configuration, account | |
| credentials, and project information. Labeling tasks and data items are also held | |
| in local storage.</p> <blockquote class="warning" data-svelte-h="svelte-gn7651"><p>Storage in Hugging Face Spaces is ephemeral by default. To persist your data | |
| across restarts, attach a <a href="./storage-buckets">Storage Bucket</a> — see the | |
| <a href="#enable-persistence-with-hf-storage-buckets">persistence section</a> below.</p></blockquote> <p data-svelte-h="svelte-19ntq6s">After launching Label Studio, you will be presented with the standard login | |
| screen. You can start by creating a new account using your email address and | |
| logging in with your new credentials. Periodically after logging in, Label | |
| Studio will warn you that the storage is ephemeral and data could be | |
| lost if your Space is restarted. You will also be preset with a prompt from | |
| Heidi, the helpful Label Studio mascot, to create a new project to start | |
| labeling your data. To get started, check out the Label Studio <a href="https://labelstud.io/blog/introduction-to-label-studio-in-hugging-face-spaces/" rel="nofollow">“Zero to One” | |
| tutorial</a> | |
| with a guide on how to build an annotation interface for sentiment analysis.</p> <h2 class="relative group"><a id="-configuring-a-production-ready-instance-of-label-studio" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#-configuring-a-production-ready-instance-of-label-studio"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>🛠️ Configuring a Production-Ready Instance of Label Studio</span></h2> <p data-svelte-h="svelte-1uy07io">To make your Space production-ready, you will need to make three configuration | |
| changes:</p> <ul data-svelte-h="svelte-13gskr3"><li><p>Disable the unrestricted creation of new accounts.</p></li> <li><p>Enable persistence by attaching a <a href="./storage-buckets">Storage Bucket</a> or an external database.</p></li> <li><p>Optionally, attach cloud storage for labeling tasks.</p></li></ul> <h3 class="relative group"><a id="disable-unrestricted-creation-of-new-accounts" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#disable-unrestricted-creation-of-new-accounts"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Disable Unrestricted Creation of New Accounts</span></h3> <p data-svelte-h="svelte-1wtsf11">The default configuration on Label Studio allows for the unrestricted creation | |
| of new accounts for anyone who has the URL for your application. You can | |
| <a href="https://labelstud.io/guide/signup.html#Restrict-signup-for-local-deployments" rel="nofollow">restrict signups</a> | |
| by adding the following configuration secrets to your Space <strong>Settings</strong>.</p> <ul data-svelte-h="svelte-1nfznj0"><li><p><code>LABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK</code>: Setting this value to <code>true</code> will | |
| disable unrestricted account creation.</p></li> <li><p><code>LABEL_STUDIO_USERNAME</code>: This is the username of the account that you will | |
| use as the first user in your Label Studio Space. It should be a valid email | |
| address.</p></li> <li><p><code>LABEL_STUDIO_PASSWORD</code>: The password that will be associated with the first | |
| user account.</p></li></ul> <p data-svelte-h="svelte-2s6qhr">Restart the Space to apply these settings. The ability to create new accounts | |
| from the login screen will be disabled. To create new accounts, you will need | |
| to invite new users in the <code>Organization</code> settings in the Label Studio | |
| application.</p> <h3 class="relative group"><a id="enable-persistence-with-hf-storage-buckets" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#enable-persistence-with-hf-storage-buckets"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Enable Persistence with HF Storage Buckets</span></h3> <p data-svelte-h="svelte-q94vyh">By default, this Space stores all project configuration and data annotations in | |
| local storage with SQLite. If the Space is reset, all configuration and | |
| annotation data in the Space will be lost.</p> <p data-svelte-h="svelte-1shrmsu">The simplest way to enable persistence is to attach a <a href="./storage-buckets">Storage Bucket</a>, | |
| which mounts persistent object storage directly into the Space. Label Studio | |
| writes its SQLite database and media uploads into the mounted bucket, so | |
| projects and annotations survive restarts.</p> <ol><li><p data-svelte-h="svelte-1305g5c"><strong>Create a bucket:</strong></p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class="language-bash "><!-- HTML_TAG_START -->hf buckets create <your-namespace>/label-studio-data<!-- HTML_TAG_END --></pre></div></li> <li data-svelte-h="svelte-12flebe"><p><strong>Attach it</strong> in Space Settings → Storage Buckets, mount path <code>/data</code>.</p></li> <li><p data-svelte-h="svelte-1ctwxda"><strong>Set two Space Variables:</strong></p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=" "><!-- HTML_TAG_START --><span class="hljs-attr">LABEL_STUDIO_BASE_DATA_DIR</span>=/data | |
| <span class="hljs-attr">STORAGE_PERSISTENCE</span>=<span class="hljs-number">1</span><!-- HTML_TAG_END --></pre></div></li> <li data-svelte-h="svelte-1800bis"><p><strong>Factory rebuild</strong> the Space.</p></li></ol> <blockquote class="tip" data-svelte-h="svelte-wzasml"><p>Set a <code>SECRET_KEY</code> Space Secret to keep user sessions alive across restarts. | |
| Without it, Label Studio generates a random key on each boot and all users | |
| are logged out on restart.</p></blockquote> <h4 class="relative group"><a id="have-a-coding-agent-do-it-for-you" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#have-a-coding-agent-do-it-for-you"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Have a coding agent do it for you</span></h4> <p data-svelte-h="svelte-19a5t19">If you’d rather not click through the Space settings, you can ask a coding agent with access to <code>huggingface_hub</code> to provision the Space for you. Tell it your Space ID and bucket name, and it can run the equivalent of:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class="language-python "><!-- HTML_TAG_START --><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi, Volume | |
| api = HfApi() | |
| space_id = <span class="hljs-string">"<your-namespace>/<your-space>"</span> | |
| <span class="hljs-comment"># Attach the bucket at /data</span> | |
| api.set_space_volumes( | |
| space_id, | |
| volumes=[ | |
| Volume(<span class="hljs-built_in">type</span>=<span class="hljs-string">"bucket"</span>, source=<span class="hljs-string">"<your-namespace>/label-studio-data"</span>, mount_path=<span class="hljs-string">"/data"</span>), | |
| ], | |
| ) | |
| <span class="hljs-comment"># Tell Label Studio to write its SQLite DB and media into the mounted bucket</span> | |
| api.add_space_variable(space_id, <span class="hljs-string">"LABEL_STUDIO_BASE_DATA_DIR"</span>, <span class="hljs-string">"/data"</span>) | |
| api.add_space_variable(space_id, <span class="hljs-string">"STORAGE_PERSISTENCE"</span>, <span class="hljs-string">"1"</span>) | |
| <span class="hljs-comment"># Optional: set a stable SECRET_KEY so sessions survive restarts</span> | |
| api.add_space_secret(space_id, <span class="hljs-string">"SECRET_KEY"</span>, <span class="hljs-string">"<random-string>"</span>) | |
| <span class="hljs-comment"># Factory rebuild so the new mount and variables take effect</span> | |
| api.restart_space(space_id, factory_reboot=<span class="hljs-literal">True</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1ssn4o8">See the <a href="/docs/huggingface_hub/guides/manage-spaces"><code>manage-spaces</code> guide</a> for more on managing spaces and volume mounts via <code>huggingface_hub</code>.</p> <h3 class="relative group"><a id="enable-persistence-with-postgres" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#enable-persistence-with-postgres"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Enable Persistence with Postgres</span></h3> <p data-svelte-h="svelte-1yhlb2l">For heavier multi-user deployments, you can instead enable persistence by | |
| <a href="https://labelstud.io/guide/storedata.html#PostgreSQL-database" rel="nofollow">connecting an external Postgres database to your | |
| space</a>, | |
| guaranteeing that all project and annotation settings are preserved.</p> <p data-svelte-h="svelte-1wk5r67">Set the following secret variables to match your own hosted instance of | |
| Postgres. We strongly recommend setting these as secrets to prevent leaking | |
| information about your database service to the public in your spaces | |
| definition.</p> <ul data-svelte-h="svelte-ttwxto"><li><p><code>DJANGO_DB</code>: Set this to <code>default</code>.</p></li> <li><p><code>POSTGRE_NAME</code>: Set this to the name of the Postgres database.</p></li> <li><p><code>POSTGRE_USER</code>: Set this to the Postgres username.</p></li> <li><p><code>POSTGRE_PASSWORD</code>: Set this to the password for your Postgres user.</p></li> <li><p><code>POSTGRE_HOST</code>: Set this to the host that your Postgres database is running | |
| on.</p></li> <li><p><code>POSTGRE_PORT</code>: Set this to the port that your Postgres database is running | |
| on.</p></li> <li><p><code>STORAGE_PERSISTENCE</code>: Set this to <code>1</code> to remove the warning about ephemeral | |
| storage.</p></li></ul> <p data-svelte-h="svelte-r9lm89">Restart the Space to apply these settings. Information about users, projects, | |
| and annotations will be stored in the database, and will be reloaded by Label | |
| Studio if the space is restarted or reset.</p> <h3 class="relative group"><a id="enable-cloud-storage" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#enable-cloud-storage"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Enable Cloud Storage</span></h3> <p data-svelte-h="svelte-1mq56yw">By default, the only data storage enabled for this Space is local. In the case | |
| of a Space reset, all data will be lost. To enable permanent storage, you must | |
| enable a <a href="https://labelstud.io/guide/storage.html" rel="nofollow">cloud storage connector</a>. | |
| Choose the appropriate cloud connector and configure the secrets for it.</p> <h4 class="relative group"><a id="amazon-s3" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#amazon-s3"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Amazon S3</span></h4> <ul data-svelte-h="svelte-dhekiv"><li><p><code>STORAGE_TYPE</code>: Set this to <code>s3</code>.</p></li> <li><p><code>STORAGE_AWS_ACCESS_KEY_ID</code>: <code><YOUR_ACCESS_KEY_ID></code></p></li> <li><p><code>STORAGE_AWS_SECRET_ACCESS_KEY</code>: <code><YOUR_SECRET_ACCESS_KEY></code></p></li> <li><p><code>STORAGE_AWS_BUCKET_NAME</code>: <code><YOUR_BUCKET_NAME></code></p></li> <li><p><code>STORAGE_AWS_REGION_NAME</code>: <code><YOUR_BUCKET_REGION></code></p></li> <li><p><code>STORAGE_AWS_FOLDER</code>: Set this to an empty string.</p></li></ul> <h4 class="relative group"><a id="google-cloud-storage" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#google-cloud-storage"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Google Cloud Storage</span></h4> <ul data-svelte-h="svelte-1yacqm5"><li><p><code>STORAGE_TYPE</code>: Set this to <code>gcs</code>.</p></li> <li><p><code>STORAGE_GCS_BUCKET_NAME</code>: <code><YOUR_BUCKET_NAME></code></p></li> <li><p><code>STORAGE_GCS_PROJECT_ID</code>: <code><YOUR_PROJECT_ID></code></p></li> <li><p><code>STORAGE_GCS_FOLDER</code>: Set this to an empty string.</p></li> <li><p><code>GOOGLE_APPLICATION_CREDENTIALS</code>: Set this to <code>/opt/heartex/secrets/key.json</code>.</p></li></ul> <h4 class="relative group"><a id="azure-blob-storage" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#azure-blob-storage"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Azure Blob Storage</span></h4> <ul data-svelte-h="svelte-1m1d2oc"><li><p><code>STORAGE_TYPE</code>: Set this to <code>azure</code>.</p></li> <li><p><code>STORAGE_AZURE_ACCOUNT_NAME</code>: <code><YOUR_STORAGE_ACCOUNT></code></p></li> <li><p><code>STORAGE_AZURE_ACCOUNT_KEY</code>: <code><YOUR_STORAGE_KEY></code></p></li> <li><p><code>STORAGE_AZURE_CONTAINER_NAME</code>: <code><YOUR_CONTAINER_NAME></code></p></li> <li><p><code>STORAGE_AZURE_FOLDER</code>: Set this to an empty string.</p></li></ul> <h2 class="relative group"><a id="-next-steps-feedback-and-support" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#-next-steps-feedback-and-support"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>🤗 Next Steps, Feedback, and Support</span></h2> <p data-svelte-h="svelte-1u6m1vl">To get started with Label Studio, check out the Label Studio <a href="https://labelstud.io/blog/introduction-to-label-studio-in-hugging-face-spaces/" rel="nofollow">“Zero to One” | |
| tutorial</a>, | |
| which walks you through an example sentiment analysis annotation project. You | |
| can find a full set of resources about Label Studio and the Label Studio | |
| community on at the <a href="https://labelstud.io" rel="nofollow">Label Studio Home Page</a>. This | |
| includes <a href="https://labelstud.io/guide/" rel="nofollow">full documentation</a>, an <a href="https://labelstud.io/playground/" rel="nofollow">interactive | |
| playground</a> for trying out different | |
| annotation interfaces, and links to join the <a href="https://slack.labelstudio.heartex.com/?source=spaces" rel="nofollow">Label Studio Slack | |
| Community</a>.</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/hub-docs/blob/main/docs/hub/spaces-sdks-docker-label-studio.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg> <span data-svelte-h="svelte-zjs2n5"><span class="underline">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1bollga = { | |
| assets: "/docs/hub/pr_2521/en", | |
| base: "/docs/hub/pr_2521/en", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/hub/pr_2521/en/_app/immutable/entry/start.d19e5ca7.js"), | |
| import("/docs/hub/pr_2521/en/_app/immutable/entry/app.98ab229a.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 221], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 39.9 kB
- Xet hash:
- 5e97d5423b0baccf0385e57e576bb0baffd76eae277782e424e4c4a4035dec96
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.