import{s as ae,A as ne,n as se,o as ie}from"../chunks/scheduler.01eeda35.js";import{S as le,i as re,g as r,s,r as k,A as pe,h as p,f as a,c as i,j as V,u as C,x as _,k as M,y as oe,a as n,v as G,d as x,t as j,w as U}from"../chunks/index.6dd51b66.js";import{C as z}from"../chunks/CodeBlock.19ec9b8c.js";import{H as me,E as fe}from"../chunks/index.58fe8f9d.js";function ce(A){let o,W,v,Z,m,P,f,N='<a href="https://www.gradio.app/" rel="nofollow">Gradio</a>, a fast and easy library for building and sharing machine learning apps, is integrated with <a href="/docs/transformers/main/en/main_classes/pipelines#transformers.Pipeline">Pipeline</a> to quickly create a simple interface for inference.',H,c,K="Before you begin, make sure Gradio is installed.",I,h,S,u,Q='Create a pipeline for your task, and then pass it to Gradio’s <a href="https://www.gradio.app/docs/gradio/interface#interface-from_pipeline" rel="nofollow">Interface.from_pipeline</a> function to create the interface. Gradio automatically determines the appropriate input and output components for a <a href="/docs/transformers/main/en/main_classes/pipelines#transformers.Pipeline">Pipeline</a>.',B,d,O='Add <a href="https://www.gradio.app/main/docs/gradio/blocks#blocks-launch" rel="nofollow">launch</a> to create a web server and start up the app.',L,w,J,g,D='The web app runs on a local server by default. To share the app with other users, set <code>share=True</code> in <a href="https://www.gradio.app/main/docs/gradio/blocks#blocks-launch" rel="nofollow">launch</a> to generate a temporary public link. For a more permanent solution, host the app on Hugging Face <a href="https://hf.co/spaces" rel="nofollow">Spaces</a>.',R,$,E,b,ee="The Space below is created with the code above and hosted on Spaces.",X,l,te,Y,y,q,T,F;return m=new me({props:{title:"Machine learning apps",local:"machine-learning-apps",headingTag:"h1"}}),h=new z({props:{code:"IXBpcCUyMGluc3RhbGwlMjBncmFkaW8=",highlighted:"!pip install gradio",wrap:!1}}),w=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBaW1wb3J0JTIwZ3JhZGlvJTIwYXMlMjBnciUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwcGlwZWxpbmUoJTIyaW1hZ2UtY2xhc3NpZmljYXRpb24lMjIlMkMlMjBtb2RlbCUzRCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0JTIyKSUwQWdyLkludGVyZmFjZS5mcm9tX3BpcGVsaW5lKHBpcGVsaW5lKS5sYXVuY2goKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline
<span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr

pipeline = pipeline(<span class="hljs-string">&quot;image-classification&quot;</span>, model=<span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>)
gr.Interface.from_pipeline(pipeline).launch()`,wrap:!1}}),$=new z({props:{code:"Z3IuSW50ZXJmYWNlLmZyb21fcGlwZWxpbmUocGlwZWxpbmUpLmxhdW5jaChzaGFyZSUzRFRydWUp",highlighted:'gr.Interface.from_pipeline(pipeline).launch(share=<span class="hljs-literal">True</span>)',wrap:!1}}),y=new fe({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/pipeline_gradio.md"}}),{c(){o=r("meta"),W=s(),v=r("p"),Z=s(),k(m.$$.fragment),P=s(),f=r("p"),f.innerHTML=N,H=s(),c=r("p"),c.textContent=K,I=s(),k(h.$$.fragment),S=s(),u=r("p"),u.innerHTML=Q,B=s(),d=r("p"),d.innerHTML=O,L=s(),k(w.$$.fragment),J=s(),g=r("p"),g.innerHTML=D,R=s(),k($.$$.fragment),E=s(),b=r("p"),b.textContent=ee,X=s(),l=r("iframe"),Y=s(),k(y.$$.fragment),q=s(),T=r("p"),this.h()},l(e){const t=pe("svelte-u9bgzb",document.head);o=p(t,"META",{name:!0,content:!0}),t.forEach(a),W=i(e),v=p(e,"P",{}),V(v).forEach(a),Z=i(e),C(m.$$.fragment,e),P=i(e),f=p(e,"P",{"data-svelte-h":!0}),_(f)!=="svelte-pozu5p"&&(f.innerHTML=N),H=i(e),c=p(e,"P",{"data-svelte-h":!0}),_(c)!=="svelte-dfk44w"&&(c.textContent=K),I=i(e),C(h.$$.fragment,e),S=i(e),u=p(e,"P",{"data-svelte-h":!0}),_(u)!=="svelte-e8di4o"&&(u.innerHTML=Q),B=i(e),d=p(e,"P",{"data-svelte-h":!0}),_(d)!=="svelte-1abbf0u"&&(d.innerHTML=O),L=i(e),C(w.$$.fragment,e),J=i(e),g=p(e,"P",{"data-svelte-h":!0}),_(g)!=="svelte-rpa9ln"&&(g.innerHTML=D),R=i(e),C($.$$.fragment,e),E=i(e),b=p(e,"P",{"data-svelte-h":!0}),_(b)!=="svelte-jbm52h"&&(b.textContent=ee),X=i(e),l=p(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),V(l).forEach(a),Y=i(e),C(y.$$.fragment,e),q=i(e),T=p(e,"P",{}),V(T).forEach(a),this.h()},h(){M(o,"name","hf:doc:metadata"),M(o,"content",he),ne(l.src,te="https://stevhliu-gradio-pipeline-demo.hf.space")||M(l,"src",te),M(l,"frameborder","0"),M(l,"width","850"),M(l,"height","850")},m(e,t){oe(document.head,o),n(e,W,t),n(e,v,t),n(e,Z,t),G(m,e,t),n(e,P,t),n(e,f,t),n(e,H,t),n(e,c,t),n(e,I,t),G(h,e,t),n(e,S,t),n(e,u,t),n(e,B,t),n(e,d,t),n(e,L,t),G(w,e,t),n(e,J,t),n(e,g,t),n(e,R,t),G($,e,t),n(e,E,t),n(e,b,t),n(e,X,t),n(e,l,t),n(e,Y,t),G(y,e,t),n(e,q,t),n(e,T,t),F=!0},p:se,i(e){F||(x(m.$$.fragment,e),x(h.$$.fragment,e),x(w.$$.fragment,e),x($.$$.fragment,e),x(y.$$.fragment,e),F=!0)},o(e){j(m.$$.fragment,e),j(h.$$.fragment,e),j(w.$$.fragment,e),j($.$$.fragment,e),j(y.$$.fragment,e),F=!1},d(e){e&&(a(W),a(v),a(Z),a(P),a(f),a(H),a(c),a(I),a(S),a(u),a(B),a(d),a(L),a(J),a(g),a(R),a(E),a(b),a(X),a(l),a(Y),a(q),a(T)),a(o),U(m,e),U(h,e),U(w,e),U($,e),U(y,e)}}}const he='{"title":"Machine learning apps","local":"machine-learning-apps","sections":[],"depth":1}';function ue(A){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class be extends le{constructor(o){super(),re(this,o,ue,ce,ae,{})}}export{be as component};
