import{s as kt,n as vt,o as Zt}from"../chunks/scheduler.cc52f4b9.js";import{S as jt,i as It,e as i,s as l,c as o,h as Rt,a as r,d as s,b as n,f as xt,g as p,j as f,k as ct,l as Xt,m as a,n as u,t as m,o as d,p as h}from"../chunks/index.5b747fde.js";import{C as qt,H as ft,E as Ht}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d38ac5a9.js";import{C as z}from"../chunks/CodeBlock.665bfc37.js";import{C as Et}from"../chunks/CourseFloatingBanner.b33fcd79.js";function Gt($t){let c,L,F,Y,g,V,y,N,w,P,b,gt="We will learn now how to export and use the annotated data that we have in Argilla.",W,C,A,J,yt="First, we’ll need to make sure that we’re connected to our Argilla instance as in the previous steps:",S,T,Q,M,wt="And now, we’ll load the dataset that we’ll be working with:",K,U,D,_,bt="Loading the dataset and calling its records with <code>dataset.records</code> is enough to start using your dataset and records for your own purposes and pipelines. However, we’ll also learn how to do a few optional operations, like filtering the records and exporting your dataset to the Hugging Face Hub.",O,x,tt,k,Ct="Sometimes you only want to use the records that have been completed, so we will first filter the records in our dataset based on their status:",et,v,st,$,Jt="<p>⚠️ Note that the records with <code>completed</code> status (i.e., records that meet the minimum submitted responses configured in the task distribution settings) could have more than one response and that each response can have any status from <code>submitted</code>, <code>draft</code> or <code>discarded</code>.</p>",at,Z,Tt='Learn more about querying and filtering records in the <a href="https://docs.argilla.io/latest/how_to_guides/query/" rel="nofollow">Argilla docs</a>.',lt,j,nt,I,Mt="We can now export our annotations to the Hugging Face Hub, so we can share them with others. To do this, we’ll need to convert the records into a 🤗 Dataset and then push it to the Hub:",it,R,ot,X,Ut="Alternatively, we can export directly the complete Argilla dataset (including pending records) like this:",rt,q,pt,H,_t="This is an interesting choice in case others want to open the dataset in their Argilla instances, as the settings are automatically saved and they can simply import the full dataset using a single line of code:",ut,E,mt,G,dt,B,ht;return g=new qt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new ft({props:{title:"Use your annotated dataset",local:"use-your-annotated-dataset",headingTag:"h1"}}),w=new Et({props:{chapter:10,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/en/chapter10/section5.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/en/chapter10/section5.ipynb"}]}}),C=new ft({props:{title:"Load the dataset",local:"load-the-dataset",headingTag:"h2"}}),T=new z({props:{code:"aW1wb3J0JTIwYXJnaWxsYSUyMGFzJTIwcmclMEElMEFIRl9UT0tFTiUyMCUzRCUyMCUyMi4uLiUyMiUyMCUyMCUyMyUyMG9ubHklMjBmb3IlMjBwcml2YXRlJTIwc3BhY2VzJTBBJTBBY2xpZW50JTIwJTNEJTIwcmcuQXJnaWxsYSglMEElMjAlMjAlMjAlMjBhcGlfdXJsJTNEJTIyLi4uJTIyJTJDJTBBJTIwJTIwJTIwJTIwYXBpX2tleSUzRCUyMi4uLiUyMiUyQyUwQSUyMCUyMCUyMCUyMGhlYWRlcnMlM0QlN0IlMjJBdXRob3JpemF0aW9uJTIyJTNBJTIwZiUyMkJlYXJlciUyMCU3QkhGX1RPS0VOJTdEJTIyJTdEJTJDJTIwJTIwJTIzJTIwb25seSUyMGZvciUyMHByaXZhdGUlMjBzcGFjZXMlMEEp",highlighted:`<span class="hljs-keyword">import</span> argilla <span class="hljs-keyword">as</span> rg

HF_TOKEN = <span class="hljs-string">&quot;...&quot;</span>  <span class="hljs-comment"># only for private spaces</span>

client = rg.Argilla(
    api_url=<span class="hljs-string">&quot;...&quot;</span>,
    api_key=<span class="hljs-string">&quot;...&quot;</span>,
    headers={<span class="hljs-string">&quot;Authorization&quot;</span>: <span class="hljs-string">f&quot;Bearer <span class="hljs-subst">{HF_TOKEN}</span>&quot;</span>},  <span class="hljs-comment"># only for private spaces</span>
)`,wrap:!1}}),U=new z({props:{code:"ZGF0YXNldCUyMCUzRCUyMGNsaWVudC5kYXRhc2V0cyhuYW1lJTNEJTIyYWdfbmV3cyUyMik=",highlighted:'dataset = client.datasets(name=<span class="hljs-string">&quot;ag_news&quot;</span>)',wrap:!1}}),x=new ft({props:{title:"Filter the dataset",local:"filter-the-dataset",headingTag:"h2"}}),v=new z({props:{code:"c3RhdHVzX2ZpbHRlciUyMCUzRCUyMHJnLlF1ZXJ5KGZpbHRlciUzRHJnLkZpbHRlciglNUIoJTIyc3RhdHVzJTIyJTJDJTIwJTIyJTNEJTNEJTIyJTJDJTIwJTIyY29tcGxldGVkJTIyKSU1RCkpJTBBJTBBZmlsdGVyZWRfcmVjb3JkcyUyMCUzRCUyMGRhdGFzZXQucmVjb3JkcyhzdGF0dXNfZmlsdGVyKQ==",highlighted:`status_filter = rg.Query(<span class="hljs-built_in">filter</span>=rg.Filter([(<span class="hljs-string">&quot;status&quot;</span>, <span class="hljs-string">&quot;==&quot;</span>, <span class="hljs-string">&quot;completed&quot;</span>)]))

filtered_records = dataset.records(status_filter)`,wrap:!1}}),j=new ft({props:{title:"Export to the Hub",local:"export-to-the-hub",headingTag:"h2"}}),R=new z({props:{code:"ZmlsdGVyZWRfcmVjb3Jkcy50b19kYXRhc2V0cygpLnB1c2hfdG9faHViKCUyMmFyZ2lsbGElMkZhZ19uZXdzX2Fubm90YXRlZCUyMik=",highlighted:'filtered_records.to_datasets().push_to_hub(<span class="hljs-string">&quot;argilla/ag_news_annotated&quot;</span>)',wrap:!1}}),q=new z({props:{code:"ZGF0YXNldC50b19odWIocmVwb19pZCUzRCUyMmFyZ2lsbGElMkZhZ19uZXdzX2Fubm90YXRlZCUyMik=",highlighted:'dataset.to_hub(repo_id=<span class="hljs-string">&quot;argilla/ag_news_annotated&quot;</span>)',wrap:!1}}),E=new z({props:{code:"ZGF0YXNldCUyMCUzRCUyMHJnLkRhdGFzZXQuZnJvbV9odWIocmVwb19pZCUzRCUyMmFyZ2lsbGElMkZhZ19uZXdzX2Fubm90YXRlZCUyMik=",highlighted:'dataset = rg.Dataset.from_hub(repo_id=<span class="hljs-string">&quot;argilla/ag_news_annotated&quot;</span>)',wrap:!1}}),G=new Ht({props:{source:"https://github.com/huggingface/course/blob/main/chapters/en/chapter10/5.mdx"}}),{c(){c=i("meta"),L=l(),F=i("p"),Y=l(),o(g.$$.fragment),V=l(),o(y.$$.fragment),N=l(),o(w.$$.fragment),P=l(),b=i("p"),b.textContent=gt,W=l(),o(C.$$.fragment),A=l(),J=i("p"),J.textContent=yt,S=l(),o(T.$$.fragment),Q=l(),M=i("p"),M.textContent=wt,K=l(),o(U.$$.fragment),D=l(),_=i("p"),_.innerHTML=bt,O=l(),o(x.$$.fragment),tt=l(),k=i("p"),k.textContent=Ct,et=l(),o(v.$$.fragment),st=l(),$=i("blockquote"),$.innerHTML=Jt,at=l(),Z=i("p"),Z.innerHTML=Tt,lt=l(),o(j.$$.fragment),nt=l(),I=i("p"),I.textContent=Mt,it=l(),o(R.$$.fragment),ot=l(),X=i("p"),X.textContent=Ut,rt=l(),o(q.$$.fragment),pt=l(),H=i("p"),H.textContent=_t,ut=l(),o(E.$$.fragment),mt=l(),o(G.$$.fragment),dt=l(),B=i("p"),this.h()},l(t){const e=Rt("svelte-u9bgzb",document.head);c=r(e,"META",{name:!0,content:!0}),e.forEach(s),L=n(t),F=r(t,"P",{}),xt(F).forEach(s),Y=n(t),p(g.$$.fragment,t),V=n(t),p(y.$$.fragment,t),N=n(t),p(w.$$.fragment,t),P=n(t),b=r(t,"P",{"data-svelte-h":!0}),f(b)!=="svelte-rtacj6"&&(b.textContent=gt),W=n(t),p(C.$$.fragment,t),A=n(t),J=r(t,"P",{"data-svelte-h":!0}),f(J)!=="svelte-17912s9"&&(J.textContent=yt),S=n(t),p(T.$$.fragment,t),Q=n(t),M=r(t,"P",{"data-svelte-h":!0}),f(M)!=="svelte-kzryh9"&&(M.textContent=wt),K=n(t),p(U.$$.fragment,t),D=n(t),_=r(t,"P",{"data-svelte-h":!0}),f(_)!=="svelte-1peasv5"&&(_.innerHTML=bt),O=n(t),p(x.$$.fragment,t),tt=n(t),k=r(t,"P",{"data-svelte-h":!0}),f(k)!=="svelte-nfhygw"&&(k.textContent=Ct),et=n(t),p(v.$$.fragment,t),st=n(t),$=r(t,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),f($)!=="svelte-106tyhe"&&($.innerHTML=Jt),at=n(t),Z=r(t,"P",{"data-svelte-h":!0}),f(Z)!=="svelte-1tk8wea"&&(Z.innerHTML=Tt),lt=n(t),p(j.$$.fragment,t),nt=n(t),I=r(t,"P",{"data-svelte-h":!0}),f(I)!=="svelte-scmc2l"&&(I.textContent=Mt),it=n(t),p(R.$$.fragment,t),ot=n(t),X=r(t,"P",{"data-svelte-h":!0}),f(X)!=="svelte-jc7lzo"&&(X.textContent=Ut),rt=n(t),p(q.$$.fragment,t),pt=n(t),H=r(t,"P",{"data-svelte-h":!0}),f(H)!=="svelte-471wcw"&&(H.textContent=_t),ut=n(t),p(E.$$.fragment,t),mt=n(t),p(G.$$.fragment,t),dt=n(t),B=r(t,"P",{}),xt(B).forEach(s),this.h()},h(){ct(c,"name","hf:doc:metadata"),ct(c,"content",zt),ct($,"class","tip")},m(t,e){Xt(document.head,c),a(t,L,e),a(t,F,e),a(t,Y,e),u(g,t,e),a(t,V,e),u(y,t,e),a(t,N,e),u(w,t,e),a(t,P,e),a(t,b,e),a(t,W,e),u(C,t,e),a(t,A,e),a(t,J,e),a(t,S,e),u(T,t,e),a(t,Q,e),a(t,M,e),a(t,K,e),u(U,t,e),a(t,D,e),a(t,_,e),a(t,O,e),u(x,t,e),a(t,tt,e),a(t,k,e),a(t,et,e),u(v,t,e),a(t,st,e),a(t,$,e),a(t,at,e),a(t,Z,e),a(t,lt,e),u(j,t,e),a(t,nt,e),a(t,I,e),a(t,it,e),u(R,t,e),a(t,ot,e),a(t,X,e),a(t,rt,e),u(q,t,e),a(t,pt,e),a(t,H,e),a(t,ut,e),u(E,t,e),a(t,mt,e),u(G,t,e),a(t,dt,e),a(t,B,e),ht=!0},p:vt,i(t){ht||(m(g.$$.fragment,t),m(y.$$.fragment,t),m(w.$$.fragment,t),m(C.$$.fragment,t),m(T.$$.fragment,t),m(U.$$.fragment,t),m(x.$$.fragment,t),m(v.$$.fragment,t),m(j.$$.fragment,t),m(R.$$.fragment,t),m(q.$$.fragment,t),m(E.$$.fragment,t),m(G.$$.fragment,t),ht=!0)},o(t){d(g.$$.fragment,t),d(y.$$.fragment,t),d(w.$$.fragment,t),d(C.$$.fragment,t),d(T.$$.fragment,t),d(U.$$.fragment,t),d(x.$$.fragment,t),d(v.$$.fragment,t),d(j.$$.fragment,t),d(R.$$.fragment,t),d(q.$$.fragment,t),d(E.$$.fragment,t),d(G.$$.fragment,t),ht=!1},d(t){t&&(s(L),s(F),s(Y),s(V),s(N),s(P),s(b),s(W),s(A),s(J),s(S),s(Q),s(M),s(K),s(D),s(_),s(O),s(tt),s(k),s(et),s(st),s($),s(at),s(Z),s(lt),s(nt),s(I),s(it),s(ot),s(X),s(rt),s(pt),s(H),s(ut),s(mt),s(dt),s(B)),s(c),h(g,t),h(y,t),h(w,t),h(C,t),h(T,t),h(U,t),h(x,t),h(v,t),h(j,t),h(R,t),h(q,t),h(E,t),h(G,t)}}}const zt='{"title":"Use your annotated dataset","local":"use-your-annotated-dataset","sections":[{"title":"Load the dataset","local":"load-the-dataset","sections":[],"depth":2},{"title":"Filter the dataset","local":"filter-the-dataset","sections":[],"depth":2},{"title":"Export to the Hub","local":"export-to-the-hub","sections":[],"depth":2}],"depth":1}';function Ft($t){return Zt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Pt extends jt{constructor(c){super(),It(this,c,Ft,Gt,kt,{})}}export{Pt as component};
