import{S as Cl,i as Ll,s as Ml,e as o,k as u,t as s,w as G,M as Rl,c as r,d as a,m as d,a as n,h as l,x as H,b as p,N as Gt,G as t,g as c,y as F,L as Dl,q as B,o as N,B as U,v as Pl}from"../../chunks/vendor-hf-doc-builder.js";import{Y as Ol}from"../../chunks/Youtube-hf-doc-builder.js";import{I as Sl}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as Ht}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as Al}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function Tl(Cs){let $,at,z,Ft,st,X,lt,k,Bt,be,Ee,Nt,Ut,ke,we,zt,Xt,ot,ne,Wt,rt,q,C,ye,W,Qt,je,Yt,nt,x,Q,Ls,Vt,Y,Ms,it,L,Jt,$e,Kt,Zt,ct,m,ie,qe,ea,ta,aa,ce,xe,sa,la,oa,pe,Se,ra,na,ia,f,Ce,ca,pa,Le,ua,da,Me,fa,ha,Re,ma,ga,De,_a,va,Pe,ba,Ea,Oe,ka,wa,Ae,ya,ja,$a,M,Te,qa,xa,Ie,Sa,Ca,La,R,Ge,Ma,Ra,He,Da,Pa,pt,V,ut,ue,Oa,dt,g,Rs,ft,J,Aa,ht,K,mt,D,Ta,Fe,Ia,Ga,gt,P,Ha,Be,Fa,Ba,_t,S,O,Ne,Z,Na,Ue,Ua,vt,de,za,bt,v,Xa,ze,Wa,Qa,Xe,Ya,Va,ee,Ja,Ka,Et,te,kt,ae,Za,wt,w,es,fe,ts,as,We,ss,ls,yt,b,os,se,rs,ns,le,is,cs,Qe,ps,us,jt,oe,$t,A,ds,Ye,fs,hs,qt,re,xt,_,Ds,St,y,ms,Ve,gs,_s,Je,vs,bs,Ct,j,Es,Ke,ks,ws,Ze,ys,js,Lt,he,$s,Mt;return X=new Al({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/chapter9/section4.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter9/section4.ipynb"}]}}),W=new Sl({}),V=new Ht({props:{code:`title = "Ask Rick a Question"
description = """
The bot was trained to answer questions based on Rick and Morty dialogues. Ask Rick anything!
<img src="https://huggingface.co/spaces/course-demos/Rick_and_Morty_QA/resolve/main/rick.png" width=200px>
"""

article = "Check out [the original Rick and Morty Bot](https://huggingface.co/spaces/kingabzpro/Rick_and_Morty_Bot) that this demo is based off of."

gr.Interface(
    fn=predict,
    inputs="textbox",
    outputs="text",
    title=title,
    description=description,
    article=article,
    examples=[["What are you doing?"], ["Where should we time travel to?"]],
).launch()`,highlighted:`title = <span class="hljs-string">&quot;Ask Rick a Question&quot;</span>
description = <span class="hljs-string">&quot;&quot;&quot;
The bot was trained to answer questions based on Rick and Morty dialogues. Ask Rick anything!
&lt;img src=&quot;https://huggingface.co/spaces/course-demos/Rick_and_Morty_QA/resolve/main/rick.png&quot; width=200px&gt;
&quot;&quot;&quot;</span>

article = <span class="hljs-string">&quot;Check out [the original Rick and Morty Bot](https://huggingface.co/spaces/kingabzpro/Rick_and_Morty_Bot) that this demo is based off of.&quot;</span>

gr.Interface(
    fn=predict,
    inputs=<span class="hljs-string">&quot;textbox&quot;</span>,
    outputs=<span class="hljs-string">&quot;text&quot;</span>,
    title=title,
    description=description,
    article=article,
    examples=[[<span class="hljs-string">&quot;What are you doing?&quot;</span>], [<span class="hljs-string">&quot;Where should we time travel to?&quot;</span>]],
).launch()`}}),K=new Ht({props:{code:'gr.Interface(classify_image, "image", "label").launch(share=True)',highlighted:'gr.Interface(classify_image, <span class="hljs-string">&quot;image&quot;</span>, <span class="hljs-string">&quot;label&quot;</span>).launch(share=<span class="hljs-literal">True</span>)'}}),Z=new Sl({}),te=new Ol({props:{id:"LS9Y2wDVI0k"}}),oe=new Ht({props:{code:`from pathlib import Path
import torch
import gradio as gr
from torch import nn

LABELS = Path("class_names.txt").read_text().splitlines()

model = nn.Sequential(
    nn.Conv2d(1, 32, 3, padding="same"),
    nn.ReLU(),
    nn.MaxPool2d(2),
    nn.Conv2d(32, 64, 3, padding="same"),
    nn.ReLU(),
    nn.MaxPool2d(2),
    nn.Conv2d(64, 128, 3, padding="same"),
    nn.ReLU(),
    nn.MaxPool2d(2),
    nn.Flatten(),
    nn.Linear(1152, 256),
    nn.ReLU(),
    nn.Linear(256, len(LABELS)),
)
state_dict = torch.load("pytorch_model.bin", map_location="cpu")
model.load_state_dict(state_dict, strict=False)
model.eval()


def predict(im):
    x = torch.tensor(im, dtype=torch.float32).unsqueeze(0).unsqueeze(0) / 255.0
    with torch.no_grad():
        out = model(x)
    probabilities = torch.nn.functional.softmax(out[0], dim=0)
    values, indices = torch.topk(probabilities, 5)
    return {LABELS[i]: v.item() for i, v in zip(indices, values)}`,highlighted:`<span class="hljs-keyword">from</span> pathlib <span class="hljs-keyword">import</span> Path
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr
<span class="hljs-keyword">from</span> torch <span class="hljs-keyword">import</span> nn

LABELS = Path(<span class="hljs-string">&quot;class_names.txt&quot;</span>).read_text().splitlines()

model = nn.Sequential(
    nn.Conv2d(<span class="hljs-number">1</span>, <span class="hljs-number">32</span>, <span class="hljs-number">3</span>, padding=<span class="hljs-string">&quot;same&quot;</span>),
    nn.ReLU(),
    nn.MaxPool2d(<span class="hljs-number">2</span>),
    nn.Conv2d(<span class="hljs-number">32</span>, <span class="hljs-number">64</span>, <span class="hljs-number">3</span>, padding=<span class="hljs-string">&quot;same&quot;</span>),
    nn.ReLU(),
    nn.MaxPool2d(<span class="hljs-number">2</span>),
    nn.Conv2d(<span class="hljs-number">64</span>, <span class="hljs-number">128</span>, <span class="hljs-number">3</span>, padding=<span class="hljs-string">&quot;same&quot;</span>),
    nn.ReLU(),
    nn.MaxPool2d(<span class="hljs-number">2</span>),
    nn.Flatten(),
    nn.Linear(<span class="hljs-number">1152</span>, <span class="hljs-number">256</span>),
    nn.ReLU(),
    nn.Linear(<span class="hljs-number">256</span>, <span class="hljs-built_in">len</span>(LABELS)),
)
state_dict = torch.load(<span class="hljs-string">&quot;pytorch_model.bin&quot;</span>, map_location=<span class="hljs-string">&quot;cpu&quot;</span>)
model.load_state_dict(state_dict, strict=<span class="hljs-literal">False</span>)
model.<span class="hljs-built_in">eval</span>()


<span class="hljs-keyword">def</span> <span class="hljs-title function_">predict</span>(<span class="hljs-params">im</span>):
    x = torch.tensor(im, dtype=torch.float32).unsqueeze(<span class="hljs-number">0</span>).unsqueeze(<span class="hljs-number">0</span>) / <span class="hljs-number">255.0</span>
    <span class="hljs-keyword">with</span> torch.no_grad():
        out = model(x)
    probabilities = torch.nn.functional.softmax(out[<span class="hljs-number">0</span>], dim=<span class="hljs-number">0</span>)
    values, indices = torch.topk(probabilities, <span class="hljs-number">5</span>)
    <span class="hljs-keyword">return</span> {LABELS[i]: v.item() <span class="hljs-keyword">for</span> i, v <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(indices, values)}`}}),re=new Ht({props:{code:`interface = gr.Interface(
    predict,
    inputs="sketchpad",
    outputs="label",
    theme="huggingface",
    title="Sketch Recognition",
    description="Who wants to play Pictionary? Draw a common object like a shovel or a laptop, and the algorithm will guess in real time!",
    article="<p style='text-align: center'>Sketch Recognition | Demo Model</p>",
    live=True,
)
interface.launch(share=True)`,highlighted:`interface = gr.Interface(
    predict,
    inputs=<span class="hljs-string">&quot;sketchpad&quot;</span>,
    outputs=<span class="hljs-string">&quot;label&quot;</span>,
    theme=<span class="hljs-string">&quot;huggingface&quot;</span>,
    title=<span class="hljs-string">&quot;Sketch Recognition&quot;</span>,
    description=<span class="hljs-string">&quot;Who wants to play Pictionary? Draw a common object like a shovel or a laptop, and the algorithm will guess in real time!&quot;</span>,
    article=<span class="hljs-string">&quot;&lt;p style=&#x27;text-align: center&#x27;&gt;Sketch Recognition | Demo Model&lt;/p&gt;&quot;</span>,
    live=<span class="hljs-literal">True</span>,
)
interface.launch(share=<span class="hljs-literal">True</span>)`}}),{c(){$=o("meta"),at=u(),z=o("h1"),Ft=s("\u4E0E\u4ED6\u4EBA\u5206\u4EAB\u6F14\u793A"),st=u(),G(X.$$.fragment),lt=u(),k=o("p"),Bt=s(`\u73B0\u5728\u60A8\u5DF2\u7ECF\u6784\u5EFA\u4E86\u4E00\u4E2A\u6F14\u793A\uFF0C\u60A8\u53EF\u80FD\u5E0C\u671B\u4E0E\u5176\u4ED6\u4EBA\u5206\u4EAB\u5B83\u3002 \u68AF\u5EA6\u6F14\u793A
\u53EF\u4EE5\u901A\u8FC7\u4E24\u79CD\u65B9\u5F0F\u5171\u4EAB\uFF1A\u4F7F\u7528 `),be=o("strong"),Ee=o("em"),Nt=s("temporary share link"),Ut=s(" \u6216 "),ke=o("strong"),we=o("em"),zt=s("permanent hosting on Spaces"),Xt=s("\u3002"),ot=u(),ne=o("p"),Wt=s("\u6211\u4EEC\u5C06\u5F88\u5FEB\u4ECB\u7ECD\u8FD9\u4E24\u79CD\u65B9\u6CD5\u3002 \u4F46\u5728\u5206\u4EAB\u6F14\u793A\u4E4B\u524D\uFF0C\u60A8\u53EF\u80FD\u9700\u8981\u5B8C\u5584\u5B83 \u{1F485}."),rt=u(),q=o("h3"),C=o("a"),ye=o("span"),G(W.$$.fragment),Qt=u(),je=o("span"),Yt=s("\u6253\u78E8\u4F60\u7684 Gradio \u6F14\u793A:"),nt=u(),x=o("div"),Q=o("img"),Vt=u(),Y=o("img"),it=u(),L=o("p"),Jt=s("\u4E3A\u4E86\u7ED9\u4F60\u7684\u6F14\u793A\u6DFB\u52A0\u989D\u5916\u7684\u5185\u5BB9\uFF0C"),$e=o("code"),Kt=s("Interface"),Zt=s(" \u7C7B\u652F\u6301\u4E00\u4E9B\u53EF\u9009\u53C2\u6570\uFF1A"),ct=u(),m=o("ul"),ie=o("li"),qe=o("code"),ea=s("title"),ta=s("\uFF1A\u4F60\u53EF\u4EE5\u7ED9\u4F60\u7684\u6F14\u793A\u4E00\u4E2A\u6807\u9898\uFF0C\u5B83\u51FA\u73B0\u5728\u8F93\u5165\u548C\u8F93\u51FA\u7EC4\u4EF6\u7684\u4E0A\u65B9\u3002"),aa=u(),ce=o("li"),xe=o("code"),sa=s("description"),la=s("\uFF1A\u60A8\u53EF\u4EE5\u4E3A\u754C\u9762\u63D0\u4F9B\u63CF\u8FF0\uFF08\u6587\u672C\u3001Markdown \u6216 HTML\uFF09\uFF0C\u663E\u793A\u5728\u8F93\u5165\u548C\u8F93\u51FA\u7EC4\u4EF6\u7684\u4E0A\u65B9\u548C\u6807\u9898\u4E0B\u65B9\u3002"),oa=u(),pe=o("li"),Se=o("code"),ra=s("article"),na=s("\uFF1A\u60A8\u8FD8\u53EF\u4EE5\u7F16\u5199\u6269\u5C55\u6587\u7AE0\uFF08\u6587\u672C\u3001Markdown \u6216 HTML\uFF09\u6765\u89E3\u91CA\u754C\u9762\u3002\u5982\u679C\u63D0\u4F9B\uFF0C\u5B83\u4F1A\u51FA\u73B0\u5728\u8F93\u5165\u548C\u8F93\u51FA\u7EC4\u4EF6\u7684_\u4E0B\u65B9\u3002"),ia=u(),f=o("li"),Ce=o("code"),ca=s("theme"),pa=s("\uFF1A\u4E0D\u559C\u6B22\u9ED8\u8BA4\u989C\u8272\uFF1F\u5C06\u4E3B\u9898\u8BBE\u7F6E\u4E3A\u4F7F\u7528 "),Le=o("code"),ua=s("default"),da=s("\u3001"),Me=o("code"),fa=s("huggingface"),ha=s("\u3001"),Re=o("code"),ma=s("grass"),ga=s("\u3001"),De=o("code"),_a=s("peach"),va=s(" \u4E4B\u4E00\u3002\u60A8\u8FD8\u53EF\u4EE5\u6DFB\u52A0 "),Pe=o("code"),ba=s("dark-"),Ea=s(" \u524D\u7F00\uFF0C\u4F8B\u5982"),Oe=o("code"),ka=s("dark-peach"),wa=s(" \u7528\u4E8E\u6DF1\u8272\u4E3B\u9898\uFF08\u6216\u8005\u53EA\u662F "),Ae=o("code"),ya=s("dark"),ja=s(" \u7528\u4E8E\u9ED8\u8BA4\u7684\u6DF1\u8272\u4E3B\u9898\uFF09\u3002"),$a=u(),M=o("li"),Te=o("code"),qa=s("examples"),xa=s("\uFF1A\u4E3A\u4E86\u8BA9\u60A8\u7684\u6F14\u793A"),Ie=o("em"),Sa=s("\u66F4\u6613\u4E8E\u4F7F\u7528"),Ca=s("\uFF0C\u60A8\u53EF\u4EE5\u4E3A\u51FD\u6570\u63D0\u4F9B\u4E00\u4E9B\u793A\u4F8B\u8F93\u5165\u3002\u5B83\u4EEC\u51FA\u73B0\u5728 UI \u7EC4\u4EF6\u4E0B\u65B9\uFF0C\u53EF\u7528\u4E8E\u586B\u5145\u754C\u9762\u3002\u8FD9\u4E9B\u5E94\u8BE5\u4F5C\u4E3A\u5D4C\u5957\u5217\u8868\u63D0\u4F9B\uFF0C\u5176\u4E2D\u5916\u90E8\u5217\u8868\u200B\u200B\u7531\u6837\u672C\u7EC4\u6210\uFF0C\u6BCF\u4E2A\u5185\u90E8\u5217\u8868\u5BF9\u5E94\u4E8E\u6BCF\u4E2A\u8F93\u5165\u7EC4\u4EF6\u7684\u8F93\u5165\u7EC4\u6210\u3002"),La=u(),R=o("li"),Ge=o("code"),Ma=s("live"),Ra=s("\uFF1A\u5982\u679C\u4F60\u60F3\u8BA9\u4F60\u7684\u6F14\u793A\u201C\u6D3B\u201D\uFF0C\u8FD9\u610F\u5473\u7740\u4F60\u7684\u6A21\u578B\u6BCF\u6B21\u8F93\u5165\u66F4\u6539\u65F6\u90FD\u4F1A\u91CD\u65B0\u8FD0\u884C\uFF0C\u4F60\u53EF\u4EE5\u8BBE\u7F6E "),He=o("code"),Da=s("live=True"),Pa=s(`\u3002\u8FD9\u5BF9\u4F7F\u7528\u5FEB\u901F\u6A21\u578B\u5F88\u6709\u610F\u4E49\uFF08\u6211\u4EEC\u5C06\u5728\u672C\u8282\u672B\u5C3E\u770B\u5230\u4E00\u4E2A\u793A\u4F8B\uFF09
\u4F7F\u7528\u4E0A\u9762\u7684\u9009\u9879\uFF0C\u6211\u4EEC\u6700\u7EC8\u5F97\u5230\u4E86\u4E00\u4E2A\u66F4\u5B8C\u6574\u7684\u754C\u9762\u3002 \u8FD0\u884C\u4E0B\u9762\u7684\u4EE3\u7801\uFF0C\u4EE5\u4FBF\u4E0E Rick and Morty \u804A\u5929\uFF1A`),pt=u(),G(V.$$.fragment),ut=u(),ue=o("p"),Oa=s("\u4F7F\u7528\u4E0A\u9762\u7684\u9009\u9879\uFF0C\u6211\u4EEC\u6700\u7EC8\u5F97\u5230\u4E86\u4E00\u4E2A\u66F4\u5B8C\u6574\u7684\u754C\u9762\u3002 \u8BD5\u8BD5\u4E0B\u9762\u7684\u754C\u9762\uFF1A"),dt=u(),g=o("iframe"),ft=u(),J=o("h3"),Aa=s("\u4F7F\u7528\u4E34\u65F6\u94FE\u63A5\u5206\u4EAB\u60A8\u7684\u6F14\u793A"),ht=s("\n\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u6709\u4E86\u673A\u5668\u5B66\u4E60\u6A21\u578B\u7684\u5DE5\u4F5C\u6F14\u793A\uFF0C\u8BA9\u6211\u4EEC\u5B66\u4E60\u5982\u4F55\u8F7B\u677E\u5171\u4EAB\u6307\u5411\u6211\u4EEC\u754C\u9762\u7684\u94FE\u63A5\u3002\n\u901A\u8FC7\u5728 `launch()` \u65B9\u6CD5\u4E2D\u8BBE\u7F6E `share=True` \u53EF\u4EE5\u8F7B\u677E\u5730\u516C\u5F00\u5171\u4EAB\u63A5\u53E3\uFF1A\n\n	"),G(K.$$.fragment),mt=u(),D=o("p"),Ta=s("\u8FD9\u4F1A\u751F\u6210\u4E00\u4E2A\u516C\u5F00\u7684\u3001\u53EF\u5171\u4EAB\u7684\u94FE\u63A5\uFF0C\u60A8\u53EF\u4EE5\u5C06\u5176\u53D1\u9001\u7ED9\u4EFB\u4F55\u4EBA\uFF01 \u5F53\u60A8\u53D1\u9001\u6B64\u94FE\u63A5\u65F6\uFF0C\u53E6\u4E00\u65B9\u7684\u7528\u6237\u53EF\u4EE5\u5728\u6D4F\u89C8\u5668\u4E2D\u8BD5\u7528\u8BE5\u6A21\u578B\u957F\u8FBE 72 \u5C0F\u65F6\u3002 \u56E0\u4E3A\u5904\u7406\u53D1\u751F\u5728\u60A8\u7684\u8BBE\u5907\u4E0A\uFF08\u53EA\u8981\u60A8\u7684\u8BBE\u5907\u4FDD\u6301\u5F00\u542F\uFF01\uFF09\uFF0C\u60A8\u4E0D\u5FC5\u62C5\u5FC3\u6253\u5305\u4EFB\u4F55\u4F9D\u8D56\u9879\u3002 \u5982\u679C\u60A8\u4F7F\u7528 Google Colab \u7B14\u8BB0\u672C\u5DE5\u4F5C\uFF0C\u5219\u59CB\u7EC8\u4F1A\u81EA\u52A8\u521B\u5EFA\u5171\u4EAB\u94FE\u63A5\u3002 \u5B83\u901A\u5E38\u770B\u8D77\u6765\u50CF\u8FD9\u6837\uFF1A"),Fe=o("strong"),Ia=s("XXXXX.gradio.app"),Ga=s("\u3002 \u867D\u7136\u94FE\u63A5\u662F\u901A\u8FC7 Gradio \u94FE\u63A5\u63D0\u4F9B\u7684\uFF0C\u4F46\u6211\u4EEC\u53EA\u662F\u60A8\u672C\u5730\u670D\u52A1\u5668\u7684\u4EE3\u7406\uFF0C\u4E0D\u4F1A\u5B58\u50A8\u901A\u8FC7\u63A5\u53E3\u53D1\u9001\u7684\u4EFB\u4F55\u6570\u636E\u3002"),gt=u(),P=o("p"),Ha=s("\u4F46\u662F\u8BF7\u8BB0\u4F4F\uFF0C\u8FD9\u4E9B\u94FE\u63A5\u662F\u53EF\u516C\u5F00\u8BBF\u95EE\u7684\uFF0C\u8FD9\u610F\u5473\u7740\u4EFB\u4F55\u4EBA\u90FD\u53EF\u4EE5\u4F7F\u7528\u60A8\u7684\u6A21\u578B\u8FDB\u884C\u9884\u6D4B\uFF01 \u56E0\u6B64\uFF0C\u8BF7\u786E\u4FDD\u4E0D\u8981\u901A\u8FC7\u60A8\u7F16\u5199\u7684\u51FD\u6570\u516C\u5F00\u4EFB\u4F55\u654F\u611F\u4FE1\u606F\uFF0C\u6216\u5141\u8BB8\u5728\u60A8\u7684\u8BBE\u5907\u4E0A\u53D1\u751F\u4EFB\u4F55\u5173\u952E\u66F4\u6539\u3002 \u5982\u679C\u8BBE\u7F6E "),Be=o("code"),Fa=s("share=False"),Ba=s("\uFF08\u9ED8\u8BA4\u503C\uFF09\uFF0C\u5219\u4EC5\u521B\u5EFA\u672C\u5730\u94FE\u63A5\u3002"),_t=u(),S=o("h3"),O=o("a"),Ne=o("span"),G(Z.$$.fragment),Na=u(),Ue=o("span"),Ua=s("\u5728 Hugging Face Spaces \u4E0A\u6258\u7BA1\u60A8\u7684\u6F14\u793A"),vt=u(),de=o("p"),za=s("\u53EF\u4EE5\u4F20\u9012\u7ED9\u540C\u4E8B\u7684\u5171\u4EAB\u94FE\u63A5\u5F88\u9177\uFF0C\u4F46\u662F\u5982\u4F55\u6C38\u4E45\u6258\u7BA1\u60A8\u7684\u6F14\u793A\u5E76\u8BA9\u5B83\u5B58\u5728\u4E8E\u4E92\u8054\u7F51\u4E0A\u81EA\u5DF1\u7684\u201C\u7A7A\u95F4\u201D\u4E2D\uFF1F"),bt=u(),v=o("p"),Xa=s("Hugging Face Spaces \u63D0\u4F9B\u4E86\u5728\u4E92\u8054\u7F51\u4E0A\u6C38\u4E45\u6258\u7BA1 Gradio \u6A21\u578B\u7684\u57FA\u7840\u8BBE\u65BD\uFF0C"),ze=o("strong"),Wa=s("\u514D\u8D39"),Qa=s(`\uFF01 Spaces \u5141\u8BB8\u60A8\u521B\u5EFA\u5E76\u63A8\u9001\u5230\uFF08\u516C\u5171\u6216\u79C1\u4EBA\uFF09\u5B58\u50A8\u5E93\uFF0C
\u4F60\u7684 Gradio \u5728\u54EA\u91CC
\u63A5\u53E3\u4EE3\u7801\u5C06\u5B58\u5728\u4E8E `),Xe=o("code"),Ya=s("app.py"),Va=s(" \u6587\u4EF6\u4E2D\u3002 "),ee=o("a"),Ja=s("\u9605\u8BFB\u5206\u6B65\u6559\u7A0B"),Ka=s(" \u5F00\u59CB\u4F7F\u7528\uFF0C\u6216\u89C2\u770B\u4E0B\u9762\u7684\u793A\u4F8B\u89C6\u9891\u3002"),Et=u(),G(te.$$.fragment),kt=u(),ae=o("h2"),Za=s("\u270F\uFE0F \u8BA9\u6211\u4EEC\u5E94\u7528\u5B83!"),wt=u(),w=o("p"),es=s("\u4F7F\u7528\u5230\u76EE\u524D\u4E3A\u6B62\u6211\u4EEC\u5728\u5404\u8282\u4E2D\u5B66\u5230\u7684\u77E5\u8BC6\uFF0C\u8BA9\u6211\u4EEC\u521B\u5EFA\u6211\u4EEC\u5728"),fe=o("a"),ts=s("\u672C\u7AE0\u7B2C\u4E00\u8282"),as=s("\u4E2D\u770B\u5230\u7684\u8349\u56FE\u8BC6\u522B\u6F14\u793A\u3002 \u8BA9\u6211\u4EEC\u4E3A\u6211\u4EEC\u7684\u754C\u9762\u6DFB\u52A0\u4E00\u4E9B\u81EA\u5B9A\u4E49\u5E76\u8BBE\u7F6E "),We=o("code"),ss=s("share=True"),ls=s(" \u4EE5\u521B\u5EFA\u4E00\u4E2A\u6211\u4EEC\u53EF\u4EE5\u4F20\u9012\u7684\u516C\u5171\u94FE\u63A5\u3002"),yt=u(),b=o("p"),os=s("\u6211\u4EEC\u53EF\u4EE5\u4ECE "),se=o("a"),rs=s("class_names.txt"),ns=s(" \u52A0\u8F7D\u6807\u7B7E\uFF0C\u5E76\u4ECE "),le=o("a"),is=s("pytorch_model.bin"),cs=s("\u52A0\u8F7D\u9884\u8BAD\u7EC3\u7684 pytorch \u6A21\u578B \u3002 \u901A\u8FC7\u70B9\u51FB\u94FE\u63A5\u5E76\u5355\u51FB\u6587\u4EF6\u9884\u89C8\u5DE6\u4E0A\u89D2\u7684\u4E0B\u8F7D\u6765\u4E0B\u8F7D\u8FD9\u4E9B\u6587\u4EF6\u3002 \u8BA9\u6211\u4EEC\u770B\u770B\u4E0B\u9762\u7684\u4EE3\u7801\uFF0C\u770B\u770B\u6211\u4EEC\u5982\u4F55\u4F7F\u7528\u8FD9\u4E9B\u6587\u4EF6\u6765\u52A0\u8F7D\u6211\u4EEC\u7684\u6A21\u578B\u5E76\u521B\u5EFA\u4E00\u4E2A"),Qe=o("code"),ps=s("predict()"),us=s("\u51FD\u6570\uFF1A"),jt=u(),G(oe.$$.fragment),$t=u(),A=o("p"),ds=s("\u73B0\u5728\u6211\u4EEC\u6709\u4E86\u4E00\u4E2A"),Ye=o("code"),fs=s("predict()"),hs=s("\u51FD\u6570\u3002 \u4E0B\u4E00\u6B65\u662F\u5B9A\u4E49\u5E76\u542F\u52A8\u6211\u4EEC\u7684\u6E10\u53D8\u754C\u9762\uFF1A"),qt=u(),G(re.$$.fragment),xt=u(),_=o("iframe"),St=u(),y=o("p"),ms=s("\u6CE8\u610F "),Ve=o("code"),gs=s("Interface"),_s=s(" \u4E2D\u7684 "),Je=o("code"),vs=s("live=True"),bs=s(` \u53C2\u6570\uFF0C\u8FD9\u610F\u5473\u7740\u8349\u56FE\u6F14\u793A\u4F7F
\u6BCF\u6B21\u6709\u4EBA\u5728\u753B\u677F\u4E0A\u753B\u753B\u65F6\u7684\u9884\u6D4B\uFF08\u6CA1\u6709\u63D0\u4EA4\u6309\u94AE\uFF01\uFF09\u3002`),Ct=u(),j=o("p"),Es=s("\u6B64\u5916\uFF0C\u6211\u4EEC\u8FD8\u5728 "),Ke=o("code"),ks=s("launch()"),ws=s(" \u65B9\u6CD5\u4E2D\u8BBE\u7F6E\u4E86 "),Ze=o("code"),ys=s("share=True"),js=s(` \u53C2\u6570\u3002
\u8FD9\u5C06\u521B\u5EFA\u4E00\u4E2A\u516C\u5171\u94FE\u63A5\uFF0C\u60A8\u53EF\u4EE5\u53D1\u9001\u7ED9\u4EFB\u4F55\u4EBA\uFF01 \u5F53\u60A8\u53D1\u9001\u6B64\u94FE\u63A5\u65F6\uFF0C\u5BF9\u65B9\u7684\u7528\u6237\u53EF\u4EE5\u5C1D\u8BD5\u8349\u56FE\u8BC6\u522B\u6A21\u578B\u3002 \u91CD\u7533\u4E00\u4E0B\uFF0C\u60A8\u8FD8\u53EF\u4EE5\u5728 Hugging Face Spaces \u4E0A\u6258\u7BA1\u6A21\u578B\uFF0C\u8FD9\u5C31\u662F\u6211\u4EEC\u80FD\u591F\u5D4C\u5165\u4E0A\u9762\u7684\u6F14\u793A\u7684\u65B9\u5F0F\u3002`),Lt=u(),he=o("p"),$s=s("\u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u5C06\u4ECB\u7ECD Gradio \u53EF\u7528\u4E8E Hugging Face \u751F\u6001\u7CFB\u7EDF\u7684\u5176\u4ED6\u65B9\u5F0F\uFF01"),this.h()},l(e){const i=Rl('[data-svelte="svelte-1phssyn"]',document.head);$=r(i,"META",{name:!0,content:!0}),i.forEach(a),at=d(e),z=r(e,"H1",{id:!0});var Ps=n(z);Ft=l(Ps,"\u4E0E\u4ED6\u4EBA\u5206\u4EAB\u6F14\u793A"),Ps.forEach(a),st=d(e),H(X.$$.fragment,e),lt=d(e),k=r(e,"P",{});var me=n(k);Bt=l(me,`\u73B0\u5728\u60A8\u5DF2\u7ECF\u6784\u5EFA\u4E86\u4E00\u4E2A\u6F14\u793A\uFF0C\u60A8\u53EF\u80FD\u5E0C\u671B\u4E0E\u5176\u4ED6\u4EBA\u5206\u4EAB\u5B83\u3002 \u68AF\u5EA6\u6F14\u793A
\u53EF\u4EE5\u901A\u8FC7\u4E24\u79CD\u65B9\u5F0F\u5171\u4EAB\uFF1A\u4F7F\u7528 `),be=r(me,"STRONG",{});var Os=n(be);Ee=r(Os,"EM",{});var As=n(Ee);Nt=l(As,"temporary share link"),As.forEach(a),Os.forEach(a),Ut=l(me," \u6216 "),ke=r(me,"STRONG",{});var Ts=n(ke);we=r(Ts,"EM",{});var Is=n(we);zt=l(Is,"permanent hosting on Spaces"),Is.forEach(a),Ts.forEach(a),Xt=l(me,"\u3002"),me.forEach(a),ot=d(e),ne=r(e,"P",{});var Gs=n(ne);Wt=l(Gs,"\u6211\u4EEC\u5C06\u5F88\u5FEB\u4ECB\u7ECD\u8FD9\u4E24\u79CD\u65B9\u6CD5\u3002 \u4F46\u5728\u5206\u4EAB\u6F14\u793A\u4E4B\u524D\uFF0C\u60A8\u53EF\u80FD\u9700\u8981\u5B8C\u5584\u5B83 \u{1F485}."),Gs.forEach(a),rt=d(e),q=r(e,"H3",{class:!0});var Rt=n(q);C=r(Rt,"A",{id:!0,class:!0,href:!0});var Hs=n(C);ye=r(Hs,"SPAN",{});var Fs=n(ye);H(W.$$.fragment,Fs),Fs.forEach(a),Hs.forEach(a),Qt=d(Rt),je=r(Rt,"SPAN",{});var Bs=n(je);Yt=l(Bs,"\u6253\u78E8\u4F60\u7684 Gradio \u6F14\u793A:"),Bs.forEach(a),Rt.forEach(a),nt=d(e),x=r(e,"DIV",{class:!0});var Dt=n(x);Q=r(Dt,"IMG",{class:!0,src:!0,alt:!0}),Vt=d(Dt),Y=r(Dt,"IMG",{class:!0,src:!0,alt:!0}),Dt.forEach(a),it=d(e),L=r(e,"P",{});var Pt=n(L);Jt=l(Pt,"\u4E3A\u4E86\u7ED9\u4F60\u7684\u6F14\u793A\u6DFB\u52A0\u989D\u5916\u7684\u5185\u5BB9\uFF0C"),$e=r(Pt,"CODE",{});var Ns=n($e);Kt=l(Ns,"Interface"),Ns.forEach(a),Zt=l(Pt," \u7C7B\u652F\u6301\u4E00\u4E9B\u53EF\u9009\u53C2\u6570\uFF1A"),Pt.forEach(a),ct=d(e),m=r(e,"UL",{});var E=n(m);ie=r(E,"LI",{});var qs=n(ie);qe=r(qs,"CODE",{});var Us=n(qe);ea=l(Us,"title"),Us.forEach(a),ta=l(qs,"\uFF1A\u4F60\u53EF\u4EE5\u7ED9\u4F60\u7684\u6F14\u793A\u4E00\u4E2A\u6807\u9898\uFF0C\u5B83\u51FA\u73B0\u5728\u8F93\u5165\u548C\u8F93\u51FA\u7EC4\u4EF6\u7684\u4E0A\u65B9\u3002"),qs.forEach(a),aa=d(E),ce=r(E,"LI",{});var xs=n(ce);xe=r(xs,"CODE",{});var zs=n(xe);sa=l(zs,"description"),zs.forEach(a),la=l(xs,"\uFF1A\u60A8\u53EF\u4EE5\u4E3A\u754C\u9762\u63D0\u4F9B\u63CF\u8FF0\uFF08\u6587\u672C\u3001Markdown \u6216 HTML\uFF09\uFF0C\u663E\u793A\u5728\u8F93\u5165\u548C\u8F93\u51FA\u7EC4\u4EF6\u7684\u4E0A\u65B9\u548C\u6807\u9898\u4E0B\u65B9\u3002"),xs.forEach(a),oa=d(E),pe=r(E,"LI",{});var Ss=n(pe);Se=r(Ss,"CODE",{});var Xs=n(Se);ra=l(Xs,"article"),Xs.forEach(a),na=l(Ss,"\uFF1A\u60A8\u8FD8\u53EF\u4EE5\u7F16\u5199\u6269\u5C55\u6587\u7AE0\uFF08\u6587\u672C\u3001Markdown \u6216 HTML\uFF09\u6765\u89E3\u91CA\u754C\u9762\u3002\u5982\u679C\u63D0\u4F9B\uFF0C\u5B83\u4F1A\u51FA\u73B0\u5728\u8F93\u5165\u548C\u8F93\u51FA\u7EC4\u4EF6\u7684_\u4E0B\u65B9\u3002"),Ss.forEach(a),ia=d(E),f=r(E,"LI",{});var h=n(f);Ce=r(h,"CODE",{});var Ws=n(Ce);ca=l(Ws,"theme"),Ws.forEach(a),pa=l(h,"\uFF1A\u4E0D\u559C\u6B22\u9ED8\u8BA4\u989C\u8272\uFF1F\u5C06\u4E3B\u9898\u8BBE\u7F6E\u4E3A\u4F7F\u7528 "),Le=r(h,"CODE",{});var Qs=n(Le);ua=l(Qs,"default"),Qs.forEach(a),da=l(h,"\u3001"),Me=r(h,"CODE",{});var Ys=n(Me);fa=l(Ys,"huggingface"),Ys.forEach(a),ha=l(h,"\u3001"),Re=r(h,"CODE",{});var Vs=n(Re);ma=l(Vs,"grass"),Vs.forEach(a),ga=l(h,"\u3001"),De=r(h,"CODE",{});var Js=n(De);_a=l(Js,"peach"),Js.forEach(a),va=l(h," \u4E4B\u4E00\u3002\u60A8\u8FD8\u53EF\u4EE5\u6DFB\u52A0 "),Pe=r(h,"CODE",{});var Ks=n(Pe);ba=l(Ks,"dark-"),Ks.forEach(a),Ea=l(h," \u524D\u7F00\uFF0C\u4F8B\u5982"),Oe=r(h,"CODE",{});var Zs=n(Oe);ka=l(Zs,"dark-peach"),Zs.forEach(a),wa=l(h," \u7528\u4E8E\u6DF1\u8272\u4E3B\u9898\uFF08\u6216\u8005\u53EA\u662F "),Ae=r(h,"CODE",{});var el=n(Ae);ya=l(el,"dark"),el.forEach(a),ja=l(h," \u7528\u4E8E\u9ED8\u8BA4\u7684\u6DF1\u8272\u4E3B\u9898\uFF09\u3002"),h.forEach(a),$a=d(E),M=r(E,"LI",{});var et=n(M);Te=r(et,"CODE",{});var tl=n(Te);qa=l(tl,"examples"),tl.forEach(a),xa=l(et,"\uFF1A\u4E3A\u4E86\u8BA9\u60A8\u7684\u6F14\u793A"),Ie=r(et,"EM",{});var al=n(Ie);Sa=l(al,"\u66F4\u6613\u4E8E\u4F7F\u7528"),al.forEach(a),Ca=l(et,"\uFF0C\u60A8\u53EF\u4EE5\u4E3A\u51FD\u6570\u63D0\u4F9B\u4E00\u4E9B\u793A\u4F8B\u8F93\u5165\u3002\u5B83\u4EEC\u51FA\u73B0\u5728 UI \u7EC4\u4EF6\u4E0B\u65B9\uFF0C\u53EF\u7528\u4E8E\u586B\u5145\u754C\u9762\u3002\u8FD9\u4E9B\u5E94\u8BE5\u4F5C\u4E3A\u5D4C\u5957\u5217\u8868\u63D0\u4F9B\uFF0C\u5176\u4E2D\u5916\u90E8\u5217\u8868\u200B\u200B\u7531\u6837\u672C\u7EC4\u6210\uFF0C\u6BCF\u4E2A\u5185\u90E8\u5217\u8868\u5BF9\u5E94\u4E8E\u6BCF\u4E2A\u8F93\u5165\u7EC4\u4EF6\u7684\u8F93\u5165\u7EC4\u6210\u3002"),et.forEach(a),La=d(E),R=r(E,"LI",{});var tt=n(R);Ge=r(tt,"CODE",{});var sl=n(Ge);Ma=l(sl,"live"),sl.forEach(a),Ra=l(tt,"\uFF1A\u5982\u679C\u4F60\u60F3\u8BA9\u4F60\u7684\u6F14\u793A\u201C\u6D3B\u201D\uFF0C\u8FD9\u610F\u5473\u7740\u4F60\u7684\u6A21\u578B\u6BCF\u6B21\u8F93\u5165\u66F4\u6539\u65F6\u90FD\u4F1A\u91CD\u65B0\u8FD0\u884C\uFF0C\u4F60\u53EF\u4EE5\u8BBE\u7F6E "),He=r(tt,"CODE",{});var ll=n(He);Da=l(ll,"live=True"),ll.forEach(a),Pa=l(tt,`\u3002\u8FD9\u5BF9\u4F7F\u7528\u5FEB\u901F\u6A21\u578B\u5F88\u6709\u610F\u4E49\uFF08\u6211\u4EEC\u5C06\u5728\u672C\u8282\u672B\u5C3E\u770B\u5230\u4E00\u4E2A\u793A\u4F8B\uFF09
\u4F7F\u7528\u4E0A\u9762\u7684\u9009\u9879\uFF0C\u6211\u4EEC\u6700\u7EC8\u5F97\u5230\u4E86\u4E00\u4E2A\u66F4\u5B8C\u6574\u7684\u754C\u9762\u3002 \u8FD0\u884C\u4E0B\u9762\u7684\u4EE3\u7801\uFF0C\u4EE5\u4FBF\u4E0E Rick and Morty \u804A\u5929\uFF1A`),tt.forEach(a),E.forEach(a),pt=d(e),H(V.$$.fragment,e),ut=d(e),ue=r(e,"P",{});var ol=n(ue);Oa=l(ol,"\u4F7F\u7528\u4E0A\u9762\u7684\u9009\u9879\uFF0C\u6211\u4EEC\u6700\u7EC8\u5F97\u5230\u4E86\u4E00\u4E2A\u66F4\u5B8C\u6574\u7684\u754C\u9762\u3002 \u8BD5\u8BD5\u4E0B\u9762\u7684\u754C\u9762\uFF1A"),ol.forEach(a),dt=d(e),g=r(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),n(g).forEach(a),ft=d(e),J=r(e,"H3",{id:!0});var rl=n(J);Aa=l(rl,"\u4F7F\u7528\u4E34\u65F6\u94FE\u63A5\u5206\u4EAB\u60A8\u7684\u6F14\u793A"),rl.forEach(a),ht=l(e,"\n\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u6709\u4E86\u673A\u5668\u5B66\u4E60\u6A21\u578B\u7684\u5DE5\u4F5C\u6F14\u793A\uFF0C\u8BA9\u6211\u4EEC\u5B66\u4E60\u5982\u4F55\u8F7B\u677E\u5171\u4EAB\u6307\u5411\u6211\u4EEC\u754C\u9762\u7684\u94FE\u63A5\u3002\n\u901A\u8FC7\u5728 `launch()` \u65B9\u6CD5\u4E2D\u8BBE\u7F6E `share=True` \u53EF\u4EE5\u8F7B\u677E\u5730\u516C\u5F00\u5171\u4EAB\u63A5\u53E3\uFF1A\n\n	"),H(K.$$.fragment,e),mt=d(e),D=r(e,"P",{});var Ot=n(D);Ta=l(Ot,"\u8FD9\u4F1A\u751F\u6210\u4E00\u4E2A\u516C\u5F00\u7684\u3001\u53EF\u5171\u4EAB\u7684\u94FE\u63A5\uFF0C\u60A8\u53EF\u4EE5\u5C06\u5176\u53D1\u9001\u7ED9\u4EFB\u4F55\u4EBA\uFF01 \u5F53\u60A8\u53D1\u9001\u6B64\u94FE\u63A5\u65F6\uFF0C\u53E6\u4E00\u65B9\u7684\u7528\u6237\u53EF\u4EE5\u5728\u6D4F\u89C8\u5668\u4E2D\u8BD5\u7528\u8BE5\u6A21\u578B\u957F\u8FBE 72 \u5C0F\u65F6\u3002 \u56E0\u4E3A\u5904\u7406\u53D1\u751F\u5728\u60A8\u7684\u8BBE\u5907\u4E0A\uFF08\u53EA\u8981\u60A8\u7684\u8BBE\u5907\u4FDD\u6301\u5F00\u542F\uFF01\uFF09\uFF0C\u60A8\u4E0D\u5FC5\u62C5\u5FC3\u6253\u5305\u4EFB\u4F55\u4F9D\u8D56\u9879\u3002 \u5982\u679C\u60A8\u4F7F\u7528 Google Colab \u7B14\u8BB0\u672C\u5DE5\u4F5C\uFF0C\u5219\u59CB\u7EC8\u4F1A\u81EA\u52A8\u521B\u5EFA\u5171\u4EAB\u94FE\u63A5\u3002 \u5B83\u901A\u5E38\u770B\u8D77\u6765\u50CF\u8FD9\u6837\uFF1A"),Fe=r(Ot,"STRONG",{});var nl=n(Fe);Ia=l(nl,"XXXXX.gradio.app"),nl.forEach(a),Ga=l(Ot,"\u3002 \u867D\u7136\u94FE\u63A5\u662F\u901A\u8FC7 Gradio \u94FE\u63A5\u63D0\u4F9B\u7684\uFF0C\u4F46\u6211\u4EEC\u53EA\u662F\u60A8\u672C\u5730\u670D\u52A1\u5668\u7684\u4EE3\u7406\uFF0C\u4E0D\u4F1A\u5B58\u50A8\u901A\u8FC7\u63A5\u53E3\u53D1\u9001\u7684\u4EFB\u4F55\u6570\u636E\u3002"),Ot.forEach(a),gt=d(e),P=r(e,"P",{});var At=n(P);Ha=l(At,"\u4F46\u662F\u8BF7\u8BB0\u4F4F\uFF0C\u8FD9\u4E9B\u94FE\u63A5\u662F\u53EF\u516C\u5F00\u8BBF\u95EE\u7684\uFF0C\u8FD9\u610F\u5473\u7740\u4EFB\u4F55\u4EBA\u90FD\u53EF\u4EE5\u4F7F\u7528\u60A8\u7684\u6A21\u578B\u8FDB\u884C\u9884\u6D4B\uFF01 \u56E0\u6B64\uFF0C\u8BF7\u786E\u4FDD\u4E0D\u8981\u901A\u8FC7\u60A8\u7F16\u5199\u7684\u51FD\u6570\u516C\u5F00\u4EFB\u4F55\u654F\u611F\u4FE1\u606F\uFF0C\u6216\u5141\u8BB8\u5728\u60A8\u7684\u8BBE\u5907\u4E0A\u53D1\u751F\u4EFB\u4F55\u5173\u952E\u66F4\u6539\u3002 \u5982\u679C\u8BBE\u7F6E "),Be=r(At,"CODE",{});var il=n(Be);Fa=l(il,"share=False"),il.forEach(a),Ba=l(At,"\uFF08\u9ED8\u8BA4\u503C\uFF09\uFF0C\u5219\u4EC5\u521B\u5EFA\u672C\u5730\u94FE\u63A5\u3002"),At.forEach(a),_t=d(e),S=r(e,"H3",{class:!0});var Tt=n(S);O=r(Tt,"A",{id:!0,class:!0,href:!0});var cl=n(O);Ne=r(cl,"SPAN",{});var pl=n(Ne);H(Z.$$.fragment,pl),pl.forEach(a),cl.forEach(a),Na=d(Tt),Ue=r(Tt,"SPAN",{});var ul=n(Ue);Ua=l(ul,"\u5728 Hugging Face Spaces \u4E0A\u6258\u7BA1\u60A8\u7684\u6F14\u793A"),ul.forEach(a),Tt.forEach(a),vt=d(e),de=r(e,"P",{});var dl=n(de);za=l(dl,"\u53EF\u4EE5\u4F20\u9012\u7ED9\u540C\u4E8B\u7684\u5171\u4EAB\u94FE\u63A5\u5F88\u9177\uFF0C\u4F46\u662F\u5982\u4F55\u6C38\u4E45\u6258\u7BA1\u60A8\u7684\u6F14\u793A\u5E76\u8BA9\u5B83\u5B58\u5728\u4E8E\u4E92\u8054\u7F51\u4E0A\u81EA\u5DF1\u7684\u201C\u7A7A\u95F4\u201D\u4E2D\uFF1F"),dl.forEach(a),bt=d(e),v=r(e,"P",{});var T=n(v);Xa=l(T,"Hugging Face Spaces \u63D0\u4F9B\u4E86\u5728\u4E92\u8054\u7F51\u4E0A\u6C38\u4E45\u6258\u7BA1 Gradio \u6A21\u578B\u7684\u57FA\u7840\u8BBE\u65BD\uFF0C"),ze=r(T,"STRONG",{});var fl=n(ze);Wa=l(fl,"\u514D\u8D39"),fl.forEach(a),Qa=l(T,`\uFF01 Spaces \u5141\u8BB8\u60A8\u521B\u5EFA\u5E76\u63A8\u9001\u5230\uFF08\u516C\u5171\u6216\u79C1\u4EBA\uFF09\u5B58\u50A8\u5E93\uFF0C
\u4F60\u7684 Gradio \u5728\u54EA\u91CC
\u63A5\u53E3\u4EE3\u7801\u5C06\u5B58\u5728\u4E8E `),Xe=r(T,"CODE",{});var hl=n(Xe);Ya=l(hl,"app.py"),hl.forEach(a),Va=l(T," \u6587\u4EF6\u4E2D\u3002 "),ee=r(T,"A",{href:!0,rel:!0});var ml=n(ee);Ja=l(ml,"\u9605\u8BFB\u5206\u6B65\u6559\u7A0B"),ml.forEach(a),Ka=l(T," \u5F00\u59CB\u4F7F\u7528\uFF0C\u6216\u89C2\u770B\u4E0B\u9762\u7684\u793A\u4F8B\u89C6\u9891\u3002"),T.forEach(a),Et=d(e),H(te.$$.fragment,e),kt=d(e),ae=r(e,"H2",{id:!0});var gl=n(ae);Za=l(gl,"\u270F\uFE0F \u8BA9\u6211\u4EEC\u5E94\u7528\u5B83!"),gl.forEach(a),wt=d(e),w=r(e,"P",{});var ge=n(w);es=l(ge,"\u4F7F\u7528\u5230\u76EE\u524D\u4E3A\u6B62\u6211\u4EEC\u5728\u5404\u8282\u4E2D\u5B66\u5230\u7684\u77E5\u8BC6\uFF0C\u8BA9\u6211\u4EEC\u521B\u5EFA\u6211\u4EEC\u5728"),fe=r(ge,"A",{href:!0});var _l=n(fe);ts=l(_l,"\u672C\u7AE0\u7B2C\u4E00\u8282"),_l.forEach(a),as=l(ge,"\u4E2D\u770B\u5230\u7684\u8349\u56FE\u8BC6\u522B\u6F14\u793A\u3002 \u8BA9\u6211\u4EEC\u4E3A\u6211\u4EEC\u7684\u754C\u9762\u6DFB\u52A0\u4E00\u4E9B\u81EA\u5B9A\u4E49\u5E76\u8BBE\u7F6E "),We=r(ge,"CODE",{});var vl=n(We);ss=l(vl,"share=True"),vl.forEach(a),ls=l(ge," \u4EE5\u521B\u5EFA\u4E00\u4E2A\u6211\u4EEC\u53EF\u4EE5\u4F20\u9012\u7684\u516C\u5171\u94FE\u63A5\u3002"),ge.forEach(a),yt=d(e),b=r(e,"P",{});var I=n(b);os=l(I,"\u6211\u4EEC\u53EF\u4EE5\u4ECE "),se=r(I,"A",{href:!0,rel:!0});var bl=n(se);rs=l(bl,"class_names.txt"),bl.forEach(a),ns=l(I," \u52A0\u8F7D\u6807\u7B7E\uFF0C\u5E76\u4ECE "),le=r(I,"A",{href:!0,rel:!0});var El=n(le);is=l(El,"pytorch_model.bin"),El.forEach(a),cs=l(I,"\u52A0\u8F7D\u9884\u8BAD\u7EC3\u7684 pytorch \u6A21\u578B \u3002 \u901A\u8FC7\u70B9\u51FB\u94FE\u63A5\u5E76\u5355\u51FB\u6587\u4EF6\u9884\u89C8\u5DE6\u4E0A\u89D2\u7684\u4E0B\u8F7D\u6765\u4E0B\u8F7D\u8FD9\u4E9B\u6587\u4EF6\u3002 \u8BA9\u6211\u4EEC\u770B\u770B\u4E0B\u9762\u7684\u4EE3\u7801\uFF0C\u770B\u770B\u6211\u4EEC\u5982\u4F55\u4F7F\u7528\u8FD9\u4E9B\u6587\u4EF6\u6765\u52A0\u8F7D\u6211\u4EEC\u7684\u6A21\u578B\u5E76\u521B\u5EFA\u4E00\u4E2A"),Qe=r(I,"CODE",{});var kl=n(Qe);ps=l(kl,"predict()"),kl.forEach(a),us=l(I,"\u51FD\u6570\uFF1A"),I.forEach(a),jt=d(e),H(oe.$$.fragment,e),$t=d(e),A=r(e,"P",{});var It=n(A);ds=l(It,"\u73B0\u5728\u6211\u4EEC\u6709\u4E86\u4E00\u4E2A"),Ye=r(It,"CODE",{});var wl=n(Ye);fs=l(wl,"predict()"),wl.forEach(a),hs=l(It,"\u51FD\u6570\u3002 \u4E0B\u4E00\u6B65\u662F\u5B9A\u4E49\u5E76\u542F\u52A8\u6211\u4EEC\u7684\u6E10\u53D8\u754C\u9762\uFF1A"),It.forEach(a),qt=d(e),H(re.$$.fragment,e),xt=d(e),_=r(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),n(_).forEach(a),St=d(e),y=r(e,"P",{});var _e=n(y);ms=l(_e,"\u6CE8\u610F "),Ve=r(_e,"CODE",{});var yl=n(Ve);gs=l(yl,"Interface"),yl.forEach(a),_s=l(_e," \u4E2D\u7684 "),Je=r(_e,"CODE",{});var jl=n(Je);vs=l(jl,"live=True"),jl.forEach(a),bs=l(_e,` \u53C2\u6570\uFF0C\u8FD9\u610F\u5473\u7740\u8349\u56FE\u6F14\u793A\u4F7F
\u6BCF\u6B21\u6709\u4EBA\u5728\u753B\u677F\u4E0A\u753B\u753B\u65F6\u7684\u9884\u6D4B\uFF08\u6CA1\u6709\u63D0\u4EA4\u6309\u94AE\uFF01\uFF09\u3002`),_e.forEach(a),Ct=d(e),j=r(e,"P",{});var ve=n(j);Es=l(ve,"\u6B64\u5916\uFF0C\u6211\u4EEC\u8FD8\u5728 "),Ke=r(ve,"CODE",{});var $l=n(Ke);ks=l($l,"launch()"),$l.forEach(a),ws=l(ve," \u65B9\u6CD5\u4E2D\u8BBE\u7F6E\u4E86 "),Ze=r(ve,"CODE",{});var ql=n(Ze);ys=l(ql,"share=True"),ql.forEach(a),js=l(ve,` \u53C2\u6570\u3002
\u8FD9\u5C06\u521B\u5EFA\u4E00\u4E2A\u516C\u5171\u94FE\u63A5\uFF0C\u60A8\u53EF\u4EE5\u53D1\u9001\u7ED9\u4EFB\u4F55\u4EBA\uFF01 \u5F53\u60A8\u53D1\u9001\u6B64\u94FE\u63A5\u65F6\uFF0C\u5BF9\u65B9\u7684\u7528\u6237\u53EF\u4EE5\u5C1D\u8BD5\u8349\u56FE\u8BC6\u522B\u6A21\u578B\u3002 \u91CD\u7533\u4E00\u4E0B\uFF0C\u60A8\u8FD8\u53EF\u4EE5\u5728 Hugging Face Spaces \u4E0A\u6258\u7BA1\u6A21\u578B\uFF0C\u8FD9\u5C31\u662F\u6211\u4EEC\u80FD\u591F\u5D4C\u5165\u4E0A\u9762\u7684\u6F14\u793A\u7684\u65B9\u5F0F\u3002`),ve.forEach(a),Lt=d(e),he=r(e,"P",{});var xl=n(he);$s=l(xl,"\u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u5C06\u4ECB\u7ECD Gradio \u53EF\u7528\u4E8E Hugging Face \u751F\u6001\u7CFB\u7EDF\u7684\u5176\u4ED6\u65B9\u5F0F\uFF01"),xl.forEach(a),this.h()},h(){p($,"name","hf:doc:metadata"),p($,"content",JSON.stringify(Il)),p(z,"id",""),p(C,"id","gradio"),p(C,"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"),p(C,"href","#gradio"),p(q,"class","relative group"),p(Q,"class","block dark:hidden"),Gt(Q.src,Ls="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter9/gradio-demo-overview.png")||p(Q,"src",Ls),p(Q,"alt","Overview of a gradio interface"),p(Y,"class","hidden dark:block"),Gt(Y.src,Ms="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter9/gradio-demo-overview-dark.png")||p(Y,"src",Ms),p(Y,"alt","Overview of a gradio interface"),p(x,"class","flex justify-center"),Gt(g.src,Rs="https://hf.space/gradioiframe/course-demos/Rick_and_Morty_QA/+")||p(g,"src",Rs),p(g,"frameborder","0"),p(g,"height","800"),p(g,"title","Gradio app"),p(g,"class","container p-0 flex-grow space-iframe"),p(g,"allow","accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking"),p(g,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),p(J,"id",""),p(O,"id","hugging-face-spaces"),p(O,"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"),p(O,"href","#hugging-face-spaces"),p(S,"class","relative group"),p(ee,"href","https://huggingface.co/blog/gradio-spaces"),p(ee,"rel","nofollow"),p(ae,"id",""),p(fe,"href","/course/chapter9/1"),p(se,"href","https://huggingface.co/spaces/dawood/Sketch-Recognition/blob/main/class_names.txt"),p(se,"rel","nofollow"),p(le,"href","https://huggingface.co/spaces/dawood/Sketch-Recognition/blob/main/pytorch_model.bin"),p(le,"rel","nofollow"),Gt(_.src,Ds="https://hf.space/gradioiframe/course-demos/Sketch-Recognition/+")||p(_,"src",Ds),p(_,"frameborder","0"),p(_,"height","650"),p(_,"title","Gradio app"),p(_,"class","container p-0 flex-grow space-iframe"),p(_,"allow","accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking"),p(_,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads")},m(e,i){t(document.head,$),c(e,at,i),c(e,z,i),t(z,Ft),c(e,st,i),F(X,e,i),c(e,lt,i),c(e,k,i),t(k,Bt),t(k,be),t(be,Ee),t(Ee,Nt),t(k,Ut),t(k,ke),t(ke,we),t(we,zt),t(k,Xt),c(e,ot,i),c(e,ne,i),t(ne,Wt),c(e,rt,i),c(e,q,i),t(q,C),t(C,ye),F(W,ye,null),t(q,Qt),t(q,je),t(je,Yt),c(e,nt,i),c(e,x,i),t(x,Q),t(x,Vt),t(x,Y),c(e,it,i),c(e,L,i),t(L,Jt),t(L,$e),t($e,Kt),t(L,Zt),c(e,ct,i),c(e,m,i),t(m,ie),t(ie,qe),t(qe,ea),t(ie,ta),t(m,aa),t(m,ce),t(ce,xe),t(xe,sa),t(ce,la),t(m,oa),t(m,pe),t(pe,Se),t(Se,ra),t(pe,na),t(m,ia),t(m,f),t(f,Ce),t(Ce,ca),t(f,pa),t(f,Le),t(Le,ua),t(f,da),t(f,Me),t(Me,fa),t(f,ha),t(f,Re),t(Re,ma),t(f,ga),t(f,De),t(De,_a),t(f,va),t(f,Pe),t(Pe,ba),t(f,Ea),t(f,Oe),t(Oe,ka),t(f,wa),t(f,Ae),t(Ae,ya),t(f,ja),t(m,$a),t(m,M),t(M,Te),t(Te,qa),t(M,xa),t(M,Ie),t(Ie,Sa),t(M,Ca),t(m,La),t(m,R),t(R,Ge),t(Ge,Ma),t(R,Ra),t(R,He),t(He,Da),t(R,Pa),c(e,pt,i),F(V,e,i),c(e,ut,i),c(e,ue,i),t(ue,Oa),c(e,dt,i),c(e,g,i),c(e,ft,i),c(e,J,i),t(J,Aa),c(e,ht,i),F(K,e,i),c(e,mt,i),c(e,D,i),t(D,Ta),t(D,Fe),t(Fe,Ia),t(D,Ga),c(e,gt,i),c(e,P,i),t(P,Ha),t(P,Be),t(Be,Fa),t(P,Ba),c(e,_t,i),c(e,S,i),t(S,O),t(O,Ne),F(Z,Ne,null),t(S,Na),t(S,Ue),t(Ue,Ua),c(e,vt,i),c(e,de,i),t(de,za),c(e,bt,i),c(e,v,i),t(v,Xa),t(v,ze),t(ze,Wa),t(v,Qa),t(v,Xe),t(Xe,Ya),t(v,Va),t(v,ee),t(ee,Ja),t(v,Ka),c(e,Et,i),F(te,e,i),c(e,kt,i),c(e,ae,i),t(ae,Za),c(e,wt,i),c(e,w,i),t(w,es),t(w,fe),t(fe,ts),t(w,as),t(w,We),t(We,ss),t(w,ls),c(e,yt,i),c(e,b,i),t(b,os),t(b,se),t(se,rs),t(b,ns),t(b,le),t(le,is),t(b,cs),t(b,Qe),t(Qe,ps),t(b,us),c(e,jt,i),F(oe,e,i),c(e,$t,i),c(e,A,i),t(A,ds),t(A,Ye),t(Ye,fs),t(A,hs),c(e,qt,i),F(re,e,i),c(e,xt,i),c(e,_,i),c(e,St,i),c(e,y,i),t(y,ms),t(y,Ve),t(Ve,gs),t(y,_s),t(y,Je),t(Je,vs),t(y,bs),c(e,Ct,i),c(e,j,i),t(j,Es),t(j,Ke),t(Ke,ks),t(j,ws),t(j,Ze),t(Ze,ys),t(j,js),c(e,Lt,i),c(e,he,i),t(he,$s),Mt=!0},p:Dl,i(e){Mt||(B(X.$$.fragment,e),B(W.$$.fragment,e),B(V.$$.fragment,e),B(K.$$.fragment,e),B(Z.$$.fragment,e),B(te.$$.fragment,e),B(oe.$$.fragment,e),B(re.$$.fragment,e),Mt=!0)},o(e){N(X.$$.fragment,e),N(W.$$.fragment,e),N(V.$$.fragment,e),N(K.$$.fragment,e),N(Z.$$.fragment,e),N(te.$$.fragment,e),N(oe.$$.fragment,e),N(re.$$.fragment,e),Mt=!1},d(e){a($),e&&a(at),e&&a(z),e&&a(st),U(X,e),e&&a(lt),e&&a(k),e&&a(ot),e&&a(ne),e&&a(rt),e&&a(q),U(W),e&&a(nt),e&&a(x),e&&a(it),e&&a(L),e&&a(ct),e&&a(m),e&&a(pt),U(V,e),e&&a(ut),e&&a(ue),e&&a(dt),e&&a(g),e&&a(ft),e&&a(J),e&&a(ht),U(K,e),e&&a(mt),e&&a(D),e&&a(gt),e&&a(P),e&&a(_t),e&&a(S),U(Z),e&&a(vt),e&&a(de),e&&a(bt),e&&a(v),e&&a(Et),U(te,e),e&&a(kt),e&&a(ae),e&&a(wt),e&&a(w),e&&a(yt),e&&a(b),e&&a(jt),U(oe,e),e&&a($t),e&&a(A),e&&a(qt),U(re,e),e&&a(xt),e&&a(_),e&&a(St),e&&a(y),e&&a(Ct),e&&a(j),e&&a(Lt),e&&a(he)}}}const Il={local:"",sections:[{local:null,sections:[{local:"gradio",title:"\u6253\u78E8\u4F60\u7684 Gradio \u6F14\u793A:"},{local:"",title:"\u4F7F\u7528\u4E34\u65F6\u94FE\u63A5\u5206\u4EAB\u60A8\u7684\u6F14\u793A"},{local:"hugging-face-spaces",title:"\u5728 Hugging Face Spaces \u4E0A\u6258\u7BA1\u60A8\u7684\u6F14\u793A"}],title:null},{local:"",title:"\u270F\uFE0F \u8BA9\u6211\u4EEC\u5E94\u7528\u5B83!"}],title:"\u4E0E\u4ED6\u4EBA\u5206\u4EAB\u6F14\u793A"};function Gl(Cs){return Pl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class zl extends Cl{constructor($){super();Ll(this,$,Gl,Tl,Ml,{})}}export{zl as default,Il as metadata};
