import{S as tr,i as sr,s as ar,e as o,k as c,t as a,w as dt,M as lr,c as r,d as s,m as u,a as i,h as l,x as mt,b as f,N as Hl,G as t,g as n,y as ht,L as or,q as _t,o as Et,B as vt,v as rr}from"../../chunks/vendor-hf-doc-builder.js";import{I as ir}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as Ul}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as pr}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function nr(Rl){let $,bt,B,ws,yt,J,wt,P,js,De,qs,ks,jt,K,Ds,qt,A,Cs,Ce,xs,$s,kt,oe,xe,Os,Dt,re,Ps,Ct,j,ie,$e,As,Is,Gs,q,Oe,Ns,Ls,Pe,Ts,gs,Ae,Ss,Fs,Ms,I,Ie,Hs,Us,Ge,Rs,zs,xt,G,Bs,W,Js,Ks,$t,d,Ws,pe,Ys,Qs,Ne,Vs,Xs,Le,Zs,ea,Te,ta,sa,ge,aa,la,Ot,Y,oa,Pt,ne,ra,At,ce,ia,It,b,pa,Se,na,ca,Fe,ua,fa,Me,da,ma,Gt,h,ha,He,_a,Ea,Ue,va,ba,Re,ya,wa,ze,ja,qa,Nt,N,ka,Be,Da,Ca,Lt,Q,Tt,L,xa,V,$a,Oa,gt,_,zl,St,ue,Pa,Ft,X,Aa,Mt,fe,Ia,Ht,de,Ga,Ut,me,Na,Rt,T,Je,La,Ta,Ke,ga,zt,g,Sa,We,Fa,Ma,Bt,Z,Jt,E,Bl,Kt,O,S,Ye,ee,Ha,he,Qe,Ua,Ra,Wt,F,za,Ve,Ba,Ja,Yt,M,Ka,Xe,Wa,Ya,Qt,H,Qa,Ze,Va,Xa,Vt,k,_e,et,Za,el,tl,Ee,tt,sl,al,ll,ve,st,ol,rl,Xt,U,il,at,pl,nl,Zt,te,cl,es,D,ul,lt,fl,dl,ot,ml,hl,ts,m,_l,rt,El,vl,be,bl,yl,it,wl,jl,pt,ql,kl,nt,Dl,Cl,ss,se,as,R,xl,ae,$l,Ol,ls,v,Jl,os,C,Pl,ct,Al,Il,ut,Gl,Nl,rs,ye,Ll,is;return J=new pr({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/section3.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter9/section3.ipynb"}]}}),Q=new Ul({props:{code:`import numpy as np
import gradio as gr


def reverse_audio(audio):
    sr, data = audio
    reversed_audio = (sr, np.flipud(data))
    return reversed_audio


mic = gr.Audio(source="microphone", type="numpy", label="Speak here...")
gr.Interface(reverse_audio, mic, "audio").launch()`,highlighted:`<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr


<span class="hljs-keyword">def</span> <span class="hljs-title function_">reverse_audio</span>(<span class="hljs-params">audio</span>):
    sr, data = audio
    reversed_audio = (sr, np.flipud(data))
    <span class="hljs-keyword">return</span> reversed_audio


mic = gr.Audio(source=<span class="hljs-string">&quot;microphone&quot;</span>, <span class="hljs-built_in">type</span>=<span class="hljs-string">&quot;numpy&quot;</span>, label=<span class="hljs-string">&quot;Speak here...&quot;</span>)
gr.Interface(reverse_audio, mic, <span class="hljs-string">&quot;audio&quot;</span>).launch()`}}),Z=new Ul({props:{code:`import numpy as np
import gradio as gr

notes = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]


def generate_tone(note, octave, duration):
    sr = 48000
    a4_freq, tones_from_a4 = 440, 12 * (octave - 4) + (note - 9)
    frequency = a4_freq * 2 ** (tones_from_a4 / 12)
    duration = int(duration)
    audio = np.linspace(0, duration, duration * sr)
    audio = (20000 * np.sin(audio * (2 * np.pi * frequency))).astype(np.int16)
    return (sr, audio)


gr.Interface(
    generate_tone,
    [
        gr.Dropdown(notes, type="index"),
        gr.Slider(minimum=4, maximum=6, step=1),
        gr.Textbox(type="number", value=1, label="Duration in seconds"),
    ],
    "audio",
).launch()`,highlighted:`<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr

notes = [<span class="hljs-string">&quot;C&quot;</span>, <span class="hljs-string">&quot;C#&quot;</span>, <span class="hljs-string">&quot;D&quot;</span>, <span class="hljs-string">&quot;D#&quot;</span>, <span class="hljs-string">&quot;E&quot;</span>, <span class="hljs-string">&quot;F&quot;</span>, <span class="hljs-string">&quot;F#&quot;</span>, <span class="hljs-string">&quot;G&quot;</span>, <span class="hljs-string">&quot;G#&quot;</span>, <span class="hljs-string">&quot;A&quot;</span>, <span class="hljs-string">&quot;A#&quot;</span>, <span class="hljs-string">&quot;B&quot;</span>]


<span class="hljs-keyword">def</span> <span class="hljs-title function_">generate_tone</span>(<span class="hljs-params">note, octave, duration</span>):
    sr = <span class="hljs-number">48000</span>
    a4_freq, tones_from_a4 = <span class="hljs-number">440</span>, <span class="hljs-number">12</span> * (octave - <span class="hljs-number">4</span>) + (note - <span class="hljs-number">9</span>)
    frequency = a4_freq * <span class="hljs-number">2</span> ** (tones_from_a4 / <span class="hljs-number">12</span>)
    duration = <span class="hljs-built_in">int</span>(duration)
    audio = np.linspace(<span class="hljs-number">0</span>, duration, duration * sr)
    audio = (<span class="hljs-number">20000</span> * np.sin(audio * (<span class="hljs-number">2</span> * np.pi * frequency))).astype(np.int16)
    <span class="hljs-keyword">return</span> (sr, audio)


gr.Interface(
    generate_tone,
    [
        gr.Dropdown(notes, <span class="hljs-built_in">type</span>=<span class="hljs-string">&quot;index&quot;</span>),
        gr.Slider(minimum=<span class="hljs-number">4</span>, maximum=<span class="hljs-number">6</span>, step=<span class="hljs-number">1</span>),
        gr.Textbox(<span class="hljs-built_in">type</span>=<span class="hljs-string">&quot;number&quot;</span>, value=<span class="hljs-number">1</span>, label=<span class="hljs-string">&quot;Duration in seconds&quot;</span>),
    ],
    <span class="hljs-string">&quot;audio&quot;</span>,
).launch()`}}),ee=new ir({}),se=new Ul({props:{code:`from transformers import pipeline
import gradio as gr

model = pipeline("automatic-speech-recognition")


def transcribe_audio(mic=None, file=None):
    if mic is not None:
        audio = mic
    elif file is not None:
        audio = file
    else:
        return "You must either provide a mic recording or a file"
    transcription = model(audio)["text"]
    return transcription


gr.Interface(
    fn=transcribe_audio,
    inputs=[
        gr.Audio(source="microphone", type="filepath", optional=True),
        gr.Audio(source="upload", type="filepath", optional=True),
    ],
    outputs="text",
).launch()`,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

model = pipeline(<span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">transcribe_audio</span>(<span class="hljs-params">mic=<span class="hljs-literal">None</span>, file=<span class="hljs-literal">None</span></span>):
    <span class="hljs-keyword">if</span> mic <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
        audio = mic
    <span class="hljs-keyword">elif</span> file <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
        audio = file
    <span class="hljs-keyword">else</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;You must either provide a mic recording or a file&quot;</span>
    transcription = model(audio)[<span class="hljs-string">&quot;text&quot;</span>]
    <span class="hljs-keyword">return</span> transcription


gr.Interface(
    fn=transcribe_audio,
    inputs=[
        gr.Audio(source=<span class="hljs-string">&quot;microphone&quot;</span>, <span class="hljs-built_in">type</span>=<span class="hljs-string">&quot;filepath&quot;</span>, optional=<span class="hljs-literal">True</span>),
        gr.Audio(source=<span class="hljs-string">&quot;upload&quot;</span>, <span class="hljs-built_in">type</span>=<span class="hljs-string">&quot;filepath&quot;</span>, optional=<span class="hljs-literal">True</span>),
    ],
    outputs=<span class="hljs-string">&quot;text&quot;</span>,
).launch()`}}),{c(){$=o("meta"),bt=c(),B=o("h1"),ws=a("\u4E86\u89E3\u63A5\u53E3\u7C7B"),yt=c(),dt(J.$$.fragment),wt=c(),P=o("p"),js=a("\u5728\u672C\u8282\u4E2D\uFF0C\u6211\u4EEC\u5C06\u4ED4\u7EC6\u7814\u7A76 "),De=o("code"),qs=a("Interface"),ks=a(" \u7C7B\uFF0C\u5E76\u4E86\u89E3\u7528\u4E8E\u521B\u5EFA\u5176\u7684\u4E3B\u8981\u53C2\u6570\u3002"),jt=c(),K=o("h2"),Ds=a("\u5982\u4F55\u521B\u5EFA\u63A5\u53E3"),qt=c(),A=o("p"),Cs=a("\u60A8\u4F1A\u6CE8\u610F\u5230 "),Ce=o("code"),xs=a("Interface"),$s=a(" \u7C7B\u6709 3 \u4E2A\u5FC5\u9700\u53C2\u6570\uFF1A"),kt=c(),oe=o("p"),xe=o("code"),Os=a("Interface(fn, inputs, outputs, ...)"),Dt=c(),re=o("p"),Ps=a("\u8FD9\u4E9B\u53C2\u6570\u662F\uFF1A"),Ct=c(),j=o("ul"),ie=o("li"),$e=o("code"),As=a("fn"),Is=a(": \u7531 Gradio \u63A5\u53E3\u5305\u88C5\u7684\u9884\u6D4B\u51FD\u6570\u3002 \u8BE5\u51FD\u6570\u53EF\u4EE5\u63A5\u53D7\u4E00\u4E2A\u6216\u591A\u4E2A\u53C2\u6570\u5E76\u8FD4\u56DE\u4E00\u4E2A\u6216\u591A\u4E2A\u503C"),Gs=c(),q=o("li"),Oe=o("code"),Ns=a("inputs"),Ls=a(": \u8F93\u5165\u7EC4\u4EF6\u7C7B\u578B\u3002 Gradio \u63D0\u4F9B\u4E86\u8BB8\u591A\u9884\u6784\u5EFA\u7684\u7EC4\u4EF6\uFF0C\u4F8B\u5982"),Pe=o("code"),Ts=a('"image"'),gs=a(" \u6216"),Ae=o("code"),Ss=a('"mic"'),Fs=a("\u3002"),Ms=c(),I=o("li"),Ie=o("code"),Hs=a("outputs"),Us=a(": \u8F93\u51FA\u7EC4\u4EF6\u7C7B\u578B\u3002 \u540C\u6837\uFF0CGradio \u63D0\u4F9B\u4E86\u8BB8\u591A\u9884\u6784\u5EFA\u7684\u7EC4\u4EF6\uFF0C\u4F8B\u5982 "),Ge=o("code"),Rs=a("\u201C\u56FE\u50CF\u201D"),zs=a("\u6216\u201C\u6807\u7B7E\u201D`\u3002"),xt=c(),G=o("p"),Bs=a("\u6709\u5173\u7EC4\u4EF6\u7684\u5B8C\u6574\u5217\u8868\uFF0C"),W=o("a"),Js=a("\u8BF7\u53C2\u9605 Gradio \u6587\u6863"),Ks=a("\u3002 \u6BCF\u4E2A\u9884\u6784\u5EFA\u7684\u7EC4\u4EF6\u90FD\u53EF\u4EE5\u901A\u8FC7\u5B9E\u4F8B\u5316\u8BE5\u7EC4\u4EF6\u5BF9\u5E94\u7684\u7C7B\u6765\u5B9A\u5236\u3002"),$t=c(),d=o("p"),Ws=a("\u4F8B\u5982\uFF0C\u6B63\u5982\u6211\u4EEC\u5728 "),pe=o("a"),Ys=a("\u4E0A\u4E00\u8282"),Qs=a(" \u4E2D\u770B\u5230\u7684\uFF0C\u60A8\u53EF\u4EE5\u4F20\u5165\u4E00\u4E2A "),Ne=o("code"),Vs=a('Textbox(lines=7, label="Prompt")'),Xs=a(" \u7EC4\u4EF6\u6765\u521B\u5EFA\u4E00\u4E2A\u5305\u542B 7 \u884C\u548C\u4E00\u4E2A\u6807\u7B7E\u7684\u6587\u672C\u6846\uFF0C\u800C\u4E0D\u662F\u5C06 "),Le=o("code"),Zs=a('"textbox"'),ea=a(" \u4F20\u9012\u7ED9 "),Te=o("code"),ta=a("inputs"),sa=a(` \u53C2\u6570\u3002
\u8BA9\u6211\u4EEC\u770B\u53E6\u4E00\u4E2A\u4F8B\u5B50\uFF0C\u8FD9\u6B21\u662F\u4E00\u4E2A `),ge=o("code"),aa=a("Audio"),la=a(" \u7EC4\u4EF6\u3002"),Ot=c(),Y=o("h2"),oa=a("\u4E00\u4E2A\u5E26\u97F3\u9891\u7684\u7B80\u5355\u793A\u4F8B"),Pt=c(),ne=o("p"),ra=a(`\u5982\u524D\u6240\u8FF0\uFF0CGradio \u63D0\u4F9B\u4E86\u8BB8\u591A\u4E0D\u540C\u7684\u8F93\u5165\u548C\u8F93\u51FA\u3002
\u56E0\u6B64\uFF0C\u8BA9\u6211\u4EEC\u6784\u5EFA\u4E00\u4E2A\u9002\u7528\u4E8E\u97F3\u9891\u7684\u201C\u63A5\u53E3\u201D\u3002`),At=c(),ce=o("p"),ia=a("\u5728\u8FD9\u4E2A\u4F8B\u5B50\u4E2D\uFF0C\u6211\u4EEC\u5C06\u6784\u5EFA\u4E00\u4E2A\u97F3\u9891\u5230\u97F3\u9891\u7684\u51FD\u6570\uFF0C\u5B83\u9700\u8981\u4E00\u4E2A\u97F3\u9891\u6587\u4EF6\u5E76\u7B80\u5355\u5730\u53CD\u8F6C\u5B83\u3002"),It=c(),b=o("p"),pa=a("\u6211\u4EEC\u5C06\u4F7F\u7528 "),Se=o("code"),na=a("Audio"),ca=a(" \u7EC4\u4EF6\u4F5C\u4E3A\u8F93\u5165\u3002 \u4F7F\u7528 "),Fe=o("code"),ua=a("Audio"),fa=a(" \u7EC4\u4EF6\u65F6\uFF0C\u60A8\u53EF\u4EE5\u6307\u5B9A\u5E0C\u671B\u97F3\u9891\u7684 "),Me=o("code"),da=a("source"),ma=a(" \u662F\u7528\u6237\u4E0A\u4F20\u7684\u6587\u4EF6\u8FD8\u662F\u7528\u6237\u5F55\u5236\u58F0\u97F3\u7684\u9EA6\u514B\u98CE\u3002 \u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u8BA9\u6211\u4EEC\u5C06\u5176\u8BBE\u7F6E\u4E3A\u201C\u9EA6\u514B\u98CE\u201D\u3002 \u53EA\u662F\u4E3A\u4E86\u597D\u73A9\uFF0C\u6211\u4EEC\u4F1A\u5728\u6211\u4EEC\u7684\u201C\u97F3\u9891\u201D\u4E2D\u6DFB\u52A0\u4E00\u4E2A\u6807\u7B7E\uFF0C\u4E0A\u9762\u5199\u7740\u201C\u5728\u8FD9\u91CC\u8BF4\u8BDD\u2026\u2026\u201D\u3002"),Gt=c(),h=o("p"),ha=a("\u6B64\u5916\uFF0C\u6211\u4EEC\u5E0C\u671B\u5C06\u97F3\u9891\u4F5C\u4E3A numpy \u6570\u7EC4\u63A5\u6536\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u53EF\u4EE5\u8F7B\u677E\u5730\u201C\u53CD\u8F6C\u201D\u5B83\u3002 \u6240\u4EE5\u6211\u4EEC\u5C06 "),He=o("code"),_a=a('"type"'),Ea=a(" \u8BBE\u7F6E\u4E3A "),Ue=o("code"),va=a('"numpy"'),ba=a("\uFF0C\u5B83\u4F1A\u4F20\u9012\u8F93\u5165data \u4F5C\u4E3A ("),Re=o("code"),ya=a("sample_rate"),wa=a(", "),ze=o("code"),ja=a("data"),qa=a(") \u7684\u5143\u7EC4\u8FDB\u5165\u6211\u4EEC\u7684\u51FD\u6570\u3002"),Nt=c(),N=o("p"),ka=a("\u6211\u4EEC\u8FD8\u5C06\u4F7F\u7528 "),Be=o("code"),Da=a("Audio"),Ca=a(" \u8F93\u51FA\u7EC4\u4EF6\uFF0C\u5B83\u53EF\u4EE5\u81EA\u52A8\u5C06\u5177\u6709\u91C7\u6837\u7387\u548C numpy \u6570\u636E\u6570\u7EC4\u7684\u5143\u7EC4\u6E32\u67D3\u4E3A\u53EF\u64AD\u653E\u7684\u97F3\u9891\u6587\u4EF6\u3002 \u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u4E0D\u9700\u8981\u8FDB\u884C\u4EFB\u4F55\u81EA\u5B9A\u4E49\uFF0C\u56E0\u6B64\u6211\u4EEC\u5C06\u4F7F\u7528\u5B57\u7B26\u4E32\u5FEB\u6377\u65B9\u5F0F\u201Caudio\u201D\u3002"),Lt=c(),dt(Q.$$.fragment),Tt=c(),L=o("p"),xa=a(`\u4E0A\u9762\u7684\u4EE3\u7801\u4F1A\u4EA7\u751F\u4E00\u4E2A\u7C7B\u4F3C\u4E0B\u9762\u7684\u754C\u9762\uFF08\u5982\u679C\u4F60\u7684\u6D4F\u89C8\u5668\u6CA1\u6709
\u8BE2\u95EE\u60A8\u7684\u9EA6\u514B\u98CE\u6743\u9650\uFF0C `),V=o("a"),$a=a("open the demo in  a separate tab"),Oa=a(".)"),gt=c(),_=o("iframe"),St=c(),ue=o("p"),Pa=a("\u60A8\u73B0\u5728\u5E94\u8BE5\u80FD\u591F\u5F55\u5236\u81EA\u5DF1\u7684\u58F0\u97F3\u5E76\u542C\u5230\u81EA\u5DF1\u5728\u53CD\u5411\u8BF4\u8BDD - \u602A\u5F02 \u{1F47B}!"),Ft=c(),X=o("h2"),Aa=a("\u5904\u7406\u591A\u4E2A\u8F93\u5165\u548C\u8F93\u51FA"),Mt=c(),fe=o("p"),Ia=a("\u5047\u8BBE\u6211\u4EEC\u6709\u4E00\u4E2A\u66F4\u590D\u6742\u7684\u51FD\u6570\uFF0C\u6709\u591A\u4E2A\u8F93\u5165\u548C\u8F93\u51FA\u3002\u5728\u4E0B\u9762\u7684\u793A\u4F8B\u4E2D\uFF0C\u6211\u4EEC\u6709\u4E00\u4E2A\u63A5\u53D7\u4E0B\u62C9\u7D22\u5F15\u3001\u6ED1\u5757\u503C\u548C\u6570\u5B57\u7684\u51FD\u6570\uFF0C\u5E76\u8FD4\u56DE\u4E00\u4E2A\u97F3\u8C03\u7684\u97F3\u9891\u6837\u672C\u3002"),Ht=c(),de=o("p"),Ga=a("\u770B\u770B\u6211\u4EEC\u5982\u4F55\u4F20\u9012\u8F93\u5165\u548C\u8F93\u51FA\u7EC4\u4EF6\u5217\u8868\uFF0C\u770B\u770B\u4F60\u80FD\u4E0D\u80FD\u8DDF\u4E0A\u6B63\u5728\u53D1\u751F\u7684\u4E8B\u60C5\u3002"),Ut=c(),me=o("p"),Na=a("\u8FD9\u91CC\u7684\u5173\u952E\u662F\u5F53\u4F60\u901A\u8FC7\u65F6\uFF1A"),Rt=c(),T=o("ul"),Je=o("li"),La=a("\u8F93\u5165\u7EC4\u4EF6\u5217\u8868\uFF0C\u6BCF\u4E2A\u7EC4\u4EF6\u4F9D\u6B21\u5BF9\u5E94\u4E00\u4E2A\u53C2\u6570\u3002"),Ta=c(),Ke=o("li"),ga=a("\u8F93\u51FA\u7EC4\u4EF6\u5217\u8868\uFF0C\u6BCF\u4E2A\u7EC4\u4EF6\u5BF9\u5E94\u4E00\u4E2A\u8FD4\u56DE\u503C\u3002"),zt=c(),g=o("p"),Sa=a("\u4E0B\u9762\u7684\u4EE3\u7801\u7247\u6BB5\u663E\u793A\u4E86\u4E09\u4E2A\u8F93\u5165\u7EC4\u4EF6\u5982\u4F55\u4E0E "),We=o("code"),Fa=a("generate_tone()"),Ma=a(" \u51FD\u6570\u7684\u4E09\u4E2A\u53C2\u6570\u5BF9\u9F50\uFF1A"),Bt=c(),dt(Z.$$.fragment),Jt=c(),E=o("iframe"),Kt=c(),O=o("h3"),S=o("a"),Ye=o("span"),dt(ee.$$.fragment),Ha=c(),he=o("span"),Qe=o("code"),Ua=a("launch()"),Ra=a(" \u65B9\u6CD5"),Wt=c(),F=o("p"),za=a("\u5230\u76EE\u524D\u4E3A\u6B62\uFF0C\u6211\u4EEC\u5DF2\u7ECF\u4F7F\u7528\u4E86"),Ve=o("code"),Ba=a("launch()"),Ja=a(`\u65B9\u6CD5\u6765\u542F\u52A8\u754C\u9762\uFF0C\u4F46\u662F\u6211\u4EEC
\u8FD8\u6CA1\u6709\u771F\u6B63\u8BA8\u8BBA\u8FC7\u5B83\u7684\u4F5C\u7528\u3002`),Yt=c(),M=o("p"),Ka=a("\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C"),Xe=o("code"),Wa=a("launch()"),Ya=a(" \u65B9\u6CD5\u5C06\u5728 Web \u670D\u52A1\u5668\u4E2D\u542F\u52A8\u6F14\u793A\u6B63\u5728\u672C\u5730\u8FD0\u884C\u3002 \u5982\u679C\u60A8\u5728 Jupyter \u6216 Colab \u7B14\u8BB0\u672C\u4E2D\u8FD0\u884C\u4EE3\u7801\uFF0C\u90A3\u4E48Gradio \u4F1A\u5C06\u6F14\u793A GUI \u5D4C\u5165\u5230\u7B14\u8BB0\u672C\u4E2D\uFF0C\u4EE5\u4FBF\u60A8\u8F7B\u677E\u4F7F\u7528\u5B83\u3002"),Qt=c(),H=o("p"),Qa=a("\u60A8\u53EF\u4EE5\u901A\u8FC7\u4E0D\u540C\u7684\u53C2\u6570\u81EA\u5B9A\u4E49 "),Ze=o("code"),Va=a("launch()"),Xa=a(" \u7684\u884C\u4E3A\uFF1A"),Vt=c(),k=o("ul"),_e=o("li"),et=o("code"),Za=a("inline"),el=a(" - whether to display the interface inline on Python notebooks."),tl=c(),Ee=o("li"),tt=o("code"),sl=a("inbrowser"),al=a(" - whether to automatically launch the interface in a new tab on the default browser."),ll=c(),ve=o("li"),st=o("code"),ol=a("share"),rl=a(" - whether to create a publicly shareable link from your computer for the interface. Kind of like a Google Drive link!"),Xt=c(),U=o("p"),il=a("\u6211\u4EEC\u5C06\u5728\u4E0B\u4E00\u8282\u4E2D\u66F4\u8BE6\u7EC6\u5730\u4ECB\u7ECD "),at=o("code"),pl=a("share"),nl=a(" \u53C2\u6570\uFF01"),Zt=c(),te=o("h2"),cl=a("\u270F\uFE0F \u8BA9\u6211\u4EEC\u5E94\u7528\u5B83\uFF01"),es=c(),D=o("p"),ul=a("\u8BA9\u6211\u4EEC\u6784\u5EFA\u4E00\u4E2A\u754C\u9762\uFF0C\u8BA9\u60A8\u6F14\u793A "),lt=o("strong"),fl=a("speech-recognition"),dl=a(` \u6A21\u578B\u3002
\u4E3A\u4E86\u8BA9\u5B83\u53D8\u5F97\u6709\u8DA3\uFF0C\u6211\u4EEC\u5C06\u63A5\u53D7 `),ot=o("em"),ml=a("or"),hl=a(" \u9EA6\u514B\u98CE\u8F93\u5165\u6216\u4E0A\u4F20\u7684\u6587\u4EF6\u3002"),ts=c(),m=o("p"),_l=a("\u50CF\u5F80\u5E38\u4E00\u6837\uFF0C\u6211\u4EEC\u5C06\u4F7F\u7528 \u{1F917} Transformers \u4E2D\u7684 "),rt=o("code"),El=a("pipeline()"),vl=a(" \u51FD\u6570\u52A0\u8F7D\u6211\u4EEC\u7684\u8BED\u97F3\u8BC6\u522B\u6A21\u578B\u3002\u5982\u679C\u60A8\u9700\u8981\u5FEB\u901F\u590D\u4E60\uFF0C\u60A8\u53EF\u4EE5\u8FD4\u56DE "),be=o("a"),bl=a("\u7B2C 1 \u7AE0\u4E2D\u7684\u90A3\u4E2A\u90E8\u5206"),yl=a("\u3002 \u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u5C06\u5B9E\u73B0\u4E00\u4E2A "),it=o("code"),wl=a("transcribe_audio()"),jl=a(" \u51FD\u6570\u6765\u5904\u7406\u97F3\u9891\u5E76\u8FD4\u56DE\u8F6C\u5F55\u3002 \u6700\u540E\uFF0C\u6211\u4EEC\u5C06\u628A\u8FD9\u4E2A\u51FD\u6570\u5305\u88C5\u5728\u4E00\u4E2A "),pt=o("code"),ql=a("Interface"),kl=a(" \u4E2D\uFF0C\u5176\u4E2D "),nt=o("code"),Dl=a("Audio"),Cl=a(" \u7EC4\u4EF6\u7528\u4E8E\u8F93\u5165\uFF0C\u53EA\u6709\u6587\u672C\u7528\u4E8E\u8F93\u51FA\u3002 \u603B\u800C\u8A00\u4E4B\uFF0C\u6B64\u5E94\u7528\u7A0B\u5E8F\u7684\u4EE3\u7801\u5982\u4E0B\uFF1A"),ss=c(),dt(se.$$.fragment),as=c(),R=o("p"),xl=a("\u5982\u679C\u60A8\u7684\u6D4F\u89C8\u5668\u6CA1\u6709\u8981\u6C42\u60A8\u63D0\u4F9B\u9EA6\u514B\u98CE\u6743\u9650\uFF0C"),ae=o("a"),$l=a("open the demo in a separate tab"),Ol=a("."),ls=c(),v=o("iframe"),os=c(),C=o("p"),Pl=a(`\u5C31\u662F\u8FD9\u6837\uFF01 \u60A8\u73B0\u5728\u53EF\u4EE5\u4F7F\u7528\u6B64\u754C\u9762\u6765\u8F6C\u5F55\u97F3\u9891\u3002 \u6CE8\u610F\u8FD9\u91CC
\u901A\u8FC7\u5C06 `),ct=o("code"),Al=a("optional"),Il=a(" \u53C2\u6570\u4F5C\u4E3A "),ut=o("code"),Gl=a("True"),Nl=a(` \u4F20\u9012\uFF0C\u6211\u4EEC\u5141\u8BB8\u7528\u6237
\u63D0\u4F9B\u9EA6\u514B\u98CE\u6216\u97F3\u9891\u6587\u4EF6\uFF08\u6216\u4E24\u8005\u90FD\u4E0D\u63D0\u4F9B\uFF0C\u4F46\u8FD9\u4F1A\u8FD4\u56DE\u9519\u8BEF\u6D88\u606F\uFF09\u3002`),rs=c(),ye=o("p"),Ll=a("\u7EE7\u7EED\u770B\u770B\u5982\u4F55\u4E0E\u4ED6\u4EBA\u5206\u4EAB\u60A8\u7684\u754C\u9762\uFF01"),this.h()},l(e){const p=lr('[data-svelte="svelte-1phssyn"]',document.head);$=r(p,"META",{name:!0,content:!0}),p.forEach(s),bt=u(e),B=r(e,"H1",{id:!0});var Kl=i(B);ws=l(Kl,"\u4E86\u89E3\u63A5\u53E3\u7C7B"),Kl.forEach(s),yt=u(e),mt(J.$$.fragment,e),wt=u(e),P=r(e,"P",{});var ps=i(P);js=l(ps,"\u5728\u672C\u8282\u4E2D\uFF0C\u6211\u4EEC\u5C06\u4ED4\u7EC6\u7814\u7A76 "),De=r(ps,"CODE",{});var Wl=i(De);qs=l(Wl,"Interface"),Wl.forEach(s),ks=l(ps," \u7C7B\uFF0C\u5E76\u4E86\u89E3\u7528\u4E8E\u521B\u5EFA\u5176\u7684\u4E3B\u8981\u53C2\u6570\u3002"),ps.forEach(s),jt=u(e),K=r(e,"H2",{id:!0});var Yl=i(K);Ds=l(Yl,"\u5982\u4F55\u521B\u5EFA\u63A5\u53E3"),Yl.forEach(s),qt=u(e),A=r(e,"P",{});var ns=i(A);Cs=l(ns,"\u60A8\u4F1A\u6CE8\u610F\u5230 "),Ce=r(ns,"CODE",{});var Ql=i(Ce);xs=l(Ql,"Interface"),Ql.forEach(s),$s=l(ns," \u7C7B\u6709 3 \u4E2A\u5FC5\u9700\u53C2\u6570\uFF1A"),ns.forEach(s),kt=u(e),oe=r(e,"P",{});var Vl=i(oe);xe=r(Vl,"CODE",{});var Xl=i(xe);Os=l(Xl,"Interface(fn, inputs, outputs, ...)"),Xl.forEach(s),Vl.forEach(s),Dt=u(e),re=r(e,"P",{});var Zl=i(re);Ps=l(Zl,"\u8FD9\u4E9B\u53C2\u6570\u662F\uFF1A"),Zl.forEach(s),Ct=u(e),j=r(e,"UL",{});var we=i(j);ie=r(we,"LI",{});var Tl=i(ie);$e=r(Tl,"CODE",{});var eo=i($e);As=l(eo,"fn"),eo.forEach(s),Is=l(Tl,": \u7531 Gradio \u63A5\u53E3\u5305\u88C5\u7684\u9884\u6D4B\u51FD\u6570\u3002 \u8BE5\u51FD\u6570\u53EF\u4EE5\u63A5\u53D7\u4E00\u4E2A\u6216\u591A\u4E2A\u53C2\u6570\u5E76\u8FD4\u56DE\u4E00\u4E2A\u6216\u591A\u4E2A\u503C"),Tl.forEach(s),Gs=u(we),q=r(we,"LI",{});var le=i(q);Oe=r(le,"CODE",{});var to=i(Oe);Ns=l(to,"inputs"),to.forEach(s),Ls=l(le,": \u8F93\u5165\u7EC4\u4EF6\u7C7B\u578B\u3002 Gradio \u63D0\u4F9B\u4E86\u8BB8\u591A\u9884\u6784\u5EFA\u7684\u7EC4\u4EF6\uFF0C\u4F8B\u5982"),Pe=r(le,"CODE",{});var so=i(Pe);Ts=l(so,'"image"'),so.forEach(s),gs=l(le," \u6216"),Ae=r(le,"CODE",{});var ao=i(Ae);Ss=l(ao,'"mic"'),ao.forEach(s),Fs=l(le,"\u3002"),le.forEach(s),Ms=u(we),I=r(we,"LI",{});var ft=i(I);Ie=r(ft,"CODE",{});var lo=i(Ie);Hs=l(lo,"outputs"),lo.forEach(s),Us=l(ft,": \u8F93\u51FA\u7EC4\u4EF6\u7C7B\u578B\u3002 \u540C\u6837\uFF0CGradio \u63D0\u4F9B\u4E86\u8BB8\u591A\u9884\u6784\u5EFA\u7684\u7EC4\u4EF6\uFF0C\u4F8B\u5982 "),Ge=r(ft,"CODE",{});var oo=i(Ge);Rs=l(oo,"\u201C\u56FE\u50CF\u201D"),oo.forEach(s),zs=l(ft,"\u6216\u201C\u6807\u7B7E\u201D`\u3002"),ft.forEach(s),we.forEach(s),xt=u(e),G=r(e,"P",{});var cs=i(G);Bs=l(cs,"\u6709\u5173\u7EC4\u4EF6\u7684\u5B8C\u6574\u5217\u8868\uFF0C"),W=r(cs,"A",{href:!0,rel:!0});var ro=i(W);Js=l(ro,"\u8BF7\u53C2\u9605 Gradio \u6587\u6863"),ro.forEach(s),Ks=l(cs,"\u3002 \u6BCF\u4E2A\u9884\u6784\u5EFA\u7684\u7EC4\u4EF6\u90FD\u53EF\u4EE5\u901A\u8FC7\u5B9E\u4F8B\u5316\u8BE5\u7EC4\u4EF6\u5BF9\u5E94\u7684\u7C7B\u6765\u5B9A\u5236\u3002"),cs.forEach(s),$t=u(e),d=r(e,"P",{});var y=i(d);Ws=l(y,"\u4F8B\u5982\uFF0C\u6B63\u5982\u6211\u4EEC\u5728 "),pe=r(y,"A",{href:!0});var io=i(pe);Ys=l(io,"\u4E0A\u4E00\u8282"),io.forEach(s),Qs=l(y," \u4E2D\u770B\u5230\u7684\uFF0C\u60A8\u53EF\u4EE5\u4F20\u5165\u4E00\u4E2A "),Ne=r(y,"CODE",{});var po=i(Ne);Vs=l(po,'Textbox(lines=7, label="Prompt")'),po.forEach(s),Xs=l(y," \u7EC4\u4EF6\u6765\u521B\u5EFA\u4E00\u4E2A\u5305\u542B 7 \u884C\u548C\u4E00\u4E2A\u6807\u7B7E\u7684\u6587\u672C\u6846\uFF0C\u800C\u4E0D\u662F\u5C06 "),Le=r(y,"CODE",{});var no=i(Le);Zs=l(no,'"textbox"'),no.forEach(s),ea=l(y," \u4F20\u9012\u7ED9 "),Te=r(y,"CODE",{});var co=i(Te);ta=l(co,"inputs"),co.forEach(s),sa=l(y,` \u53C2\u6570\u3002
\u8BA9\u6211\u4EEC\u770B\u53E6\u4E00\u4E2A\u4F8B\u5B50\uFF0C\u8FD9\u6B21\u662F\u4E00\u4E2A `),ge=r(y,"CODE",{});var uo=i(ge);aa=l(uo,"Audio"),uo.forEach(s),la=l(y," \u7EC4\u4EF6\u3002"),y.forEach(s),Ot=u(e),Y=r(e,"H2",{id:!0});var fo=i(Y);oa=l(fo,"\u4E00\u4E2A\u5E26\u97F3\u9891\u7684\u7B80\u5355\u793A\u4F8B"),fo.forEach(s),Pt=u(e),ne=r(e,"P",{});var mo=i(ne);ra=l(mo,`\u5982\u524D\u6240\u8FF0\uFF0CGradio \u63D0\u4F9B\u4E86\u8BB8\u591A\u4E0D\u540C\u7684\u8F93\u5165\u548C\u8F93\u51FA\u3002
\u56E0\u6B64\uFF0C\u8BA9\u6211\u4EEC\u6784\u5EFA\u4E00\u4E2A\u9002\u7528\u4E8E\u97F3\u9891\u7684\u201C\u63A5\u53E3\u201D\u3002`),mo.forEach(s),At=u(e),ce=r(e,"P",{});var ho=i(ce);ia=l(ho,"\u5728\u8FD9\u4E2A\u4F8B\u5B50\u4E2D\uFF0C\u6211\u4EEC\u5C06\u6784\u5EFA\u4E00\u4E2A\u97F3\u9891\u5230\u97F3\u9891\u7684\u51FD\u6570\uFF0C\u5B83\u9700\u8981\u4E00\u4E2A\u97F3\u9891\u6587\u4EF6\u5E76\u7B80\u5355\u5730\u53CD\u8F6C\u5B83\u3002"),ho.forEach(s),It=u(e),b=r(e,"P",{});var z=i(b);pa=l(z,"\u6211\u4EEC\u5C06\u4F7F\u7528 "),Se=r(z,"CODE",{});var _o=i(Se);na=l(_o,"Audio"),_o.forEach(s),ca=l(z," \u7EC4\u4EF6\u4F5C\u4E3A\u8F93\u5165\u3002 \u4F7F\u7528 "),Fe=r(z,"CODE",{});var Eo=i(Fe);ua=l(Eo,"Audio"),Eo.forEach(s),fa=l(z," \u7EC4\u4EF6\u65F6\uFF0C\u60A8\u53EF\u4EE5\u6307\u5B9A\u5E0C\u671B\u97F3\u9891\u7684 "),Me=r(z,"CODE",{});var vo=i(Me);da=l(vo,"source"),vo.forEach(s),ma=l(z," \u662F\u7528\u6237\u4E0A\u4F20\u7684\u6587\u4EF6\u8FD8\u662F\u7528\u6237\u5F55\u5236\u58F0\u97F3\u7684\u9EA6\u514B\u98CE\u3002 \u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u8BA9\u6211\u4EEC\u5C06\u5176\u8BBE\u7F6E\u4E3A\u201C\u9EA6\u514B\u98CE\u201D\u3002 \u53EA\u662F\u4E3A\u4E86\u597D\u73A9\uFF0C\u6211\u4EEC\u4F1A\u5728\u6211\u4EEC\u7684\u201C\u97F3\u9891\u201D\u4E2D\u6DFB\u52A0\u4E00\u4E2A\u6807\u7B7E\uFF0C\u4E0A\u9762\u5199\u7740\u201C\u5728\u8FD9\u91CC\u8BF4\u8BDD\u2026\u2026\u201D\u3002"),z.forEach(s),Gt=u(e),h=r(e,"P",{});var x=i(h);ha=l(x,"\u6B64\u5916\uFF0C\u6211\u4EEC\u5E0C\u671B\u5C06\u97F3\u9891\u4F5C\u4E3A numpy \u6570\u7EC4\u63A5\u6536\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u53EF\u4EE5\u8F7B\u677E\u5730\u201C\u53CD\u8F6C\u201D\u5B83\u3002 \u6240\u4EE5\u6211\u4EEC\u5C06 "),He=r(x,"CODE",{});var bo=i(He);_a=l(bo,'"type"'),bo.forEach(s),Ea=l(x," \u8BBE\u7F6E\u4E3A "),Ue=r(x,"CODE",{});var yo=i(Ue);va=l(yo,'"numpy"'),yo.forEach(s),ba=l(x,"\uFF0C\u5B83\u4F1A\u4F20\u9012\u8F93\u5165data \u4F5C\u4E3A ("),Re=r(x,"CODE",{});var wo=i(Re);ya=l(wo,"sample_rate"),wo.forEach(s),wa=l(x,", "),ze=r(x,"CODE",{});var jo=i(ze);ja=l(jo,"data"),jo.forEach(s),qa=l(x,") \u7684\u5143\u7EC4\u8FDB\u5165\u6211\u4EEC\u7684\u51FD\u6570\u3002"),x.forEach(s),Nt=u(e),N=r(e,"P",{});var us=i(N);ka=l(us,"\u6211\u4EEC\u8FD8\u5C06\u4F7F\u7528 "),Be=r(us,"CODE",{});var qo=i(Be);Da=l(qo,"Audio"),qo.forEach(s),Ca=l(us," \u8F93\u51FA\u7EC4\u4EF6\uFF0C\u5B83\u53EF\u4EE5\u81EA\u52A8\u5C06\u5177\u6709\u91C7\u6837\u7387\u548C numpy \u6570\u636E\u6570\u7EC4\u7684\u5143\u7EC4\u6E32\u67D3\u4E3A\u53EF\u64AD\u653E\u7684\u97F3\u9891\u6587\u4EF6\u3002 \u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u4E0D\u9700\u8981\u8FDB\u884C\u4EFB\u4F55\u81EA\u5B9A\u4E49\uFF0C\u56E0\u6B64\u6211\u4EEC\u5C06\u4F7F\u7528\u5B57\u7B26\u4E32\u5FEB\u6377\u65B9\u5F0F\u201Caudio\u201D\u3002"),us.forEach(s),Lt=u(e),mt(Q.$$.fragment,e),Tt=u(e),L=r(e,"P",{});var fs=i(L);xa=l(fs,`\u4E0A\u9762\u7684\u4EE3\u7801\u4F1A\u4EA7\u751F\u4E00\u4E2A\u7C7B\u4F3C\u4E0B\u9762\u7684\u754C\u9762\uFF08\u5982\u679C\u4F60\u7684\u6D4F\u89C8\u5668\u6CA1\u6709
\u8BE2\u95EE\u60A8\u7684\u9EA6\u514B\u98CE\u6743\u9650\uFF0C `),V=r(fs,"A",{href:!0,target:!0});var ko=i(V);$a=l(ko,"open the demo in  a separate tab"),ko.forEach(s),Oa=l(fs,".)"),fs.forEach(s),gt=u(e),_=r(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),i(_).forEach(s),St=u(e),ue=r(e,"P",{});var Do=i(ue);Pa=l(Do,"\u60A8\u73B0\u5728\u5E94\u8BE5\u80FD\u591F\u5F55\u5236\u81EA\u5DF1\u7684\u58F0\u97F3\u5E76\u542C\u5230\u81EA\u5DF1\u5728\u53CD\u5411\u8BF4\u8BDD - \u602A\u5F02 \u{1F47B}!"),Do.forEach(s),Ft=u(e),X=r(e,"H2",{id:!0});var Co=i(X);Aa=l(Co,"\u5904\u7406\u591A\u4E2A\u8F93\u5165\u548C\u8F93\u51FA"),Co.forEach(s),Mt=u(e),fe=r(e,"P",{});var xo=i(fe);Ia=l(xo,"\u5047\u8BBE\u6211\u4EEC\u6709\u4E00\u4E2A\u66F4\u590D\u6742\u7684\u51FD\u6570\uFF0C\u6709\u591A\u4E2A\u8F93\u5165\u548C\u8F93\u51FA\u3002\u5728\u4E0B\u9762\u7684\u793A\u4F8B\u4E2D\uFF0C\u6211\u4EEC\u6709\u4E00\u4E2A\u63A5\u53D7\u4E0B\u62C9\u7D22\u5F15\u3001\u6ED1\u5757\u503C\u548C\u6570\u5B57\u7684\u51FD\u6570\uFF0C\u5E76\u8FD4\u56DE\u4E00\u4E2A\u97F3\u8C03\u7684\u97F3\u9891\u6837\u672C\u3002"),xo.forEach(s),Ht=u(e),de=r(e,"P",{});var $o=i(de);Ga=l($o,"\u770B\u770B\u6211\u4EEC\u5982\u4F55\u4F20\u9012\u8F93\u5165\u548C\u8F93\u51FA\u7EC4\u4EF6\u5217\u8868\uFF0C\u770B\u770B\u4F60\u80FD\u4E0D\u80FD\u8DDF\u4E0A\u6B63\u5728\u53D1\u751F\u7684\u4E8B\u60C5\u3002"),$o.forEach(s),Ut=u(e),me=r(e,"P",{});var Oo=i(me);Na=l(Oo,"\u8FD9\u91CC\u7684\u5173\u952E\u662F\u5F53\u4F60\u901A\u8FC7\u65F6\uFF1A"),Oo.forEach(s),Rt=u(e),T=r(e,"UL",{});var ds=i(T);Je=r(ds,"LI",{});var Po=i(Je);La=l(Po,"\u8F93\u5165\u7EC4\u4EF6\u5217\u8868\uFF0C\u6BCF\u4E2A\u7EC4\u4EF6\u4F9D\u6B21\u5BF9\u5E94\u4E00\u4E2A\u53C2\u6570\u3002"),Po.forEach(s),Ta=u(ds),Ke=r(ds,"LI",{});var Ao=i(Ke);ga=l(Ao,"\u8F93\u51FA\u7EC4\u4EF6\u5217\u8868\uFF0C\u6BCF\u4E2A\u7EC4\u4EF6\u5BF9\u5E94\u4E00\u4E2A\u8FD4\u56DE\u503C\u3002"),Ao.forEach(s),ds.forEach(s),zt=u(e),g=r(e,"P",{});var ms=i(g);Sa=l(ms,"\u4E0B\u9762\u7684\u4EE3\u7801\u7247\u6BB5\u663E\u793A\u4E86\u4E09\u4E2A\u8F93\u5165\u7EC4\u4EF6\u5982\u4F55\u4E0E "),We=r(ms,"CODE",{});var Io=i(We);Fa=l(Io,"generate_tone()"),Io.forEach(s),Ma=l(ms," \u51FD\u6570\u7684\u4E09\u4E2A\u53C2\u6570\u5BF9\u9F50\uFF1A"),ms.forEach(s),Bt=u(e),mt(Z.$$.fragment,e),Jt=u(e),E=r(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),i(E).forEach(s),Kt=u(e),O=r(e,"H3",{class:!0});var hs=i(O);S=r(hs,"A",{id:!0,class:!0,href:!0});var Go=i(S);Ye=r(Go,"SPAN",{});var No=i(Ye);mt(ee.$$.fragment,No),No.forEach(s),Go.forEach(s),Ha=u(hs),he=r(hs,"SPAN",{});var gl=i(he);Qe=r(gl,"CODE",{});var Lo=i(Qe);Ua=l(Lo,"launch()"),Lo.forEach(s),Ra=l(gl," \u65B9\u6CD5"),gl.forEach(s),hs.forEach(s),Wt=u(e),F=r(e,"P",{});var _s=i(F);za=l(_s,"\u5230\u76EE\u524D\u4E3A\u6B62\uFF0C\u6211\u4EEC\u5DF2\u7ECF\u4F7F\u7528\u4E86"),Ve=r(_s,"CODE",{});var To=i(Ve);Ba=l(To,"launch()"),To.forEach(s),Ja=l(_s,`\u65B9\u6CD5\u6765\u542F\u52A8\u754C\u9762\uFF0C\u4F46\u662F\u6211\u4EEC
\u8FD8\u6CA1\u6709\u771F\u6B63\u8BA8\u8BBA\u8FC7\u5B83\u7684\u4F5C\u7528\u3002`),_s.forEach(s),Yt=u(e),M=r(e,"P",{});var Es=i(M);Ka=l(Es,"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C"),Xe=r(Es,"CODE",{});var go=i(Xe);Wa=l(go,"launch()"),go.forEach(s),Ya=l(Es," \u65B9\u6CD5\u5C06\u5728 Web \u670D\u52A1\u5668\u4E2D\u542F\u52A8\u6F14\u793A\u6B63\u5728\u672C\u5730\u8FD0\u884C\u3002 \u5982\u679C\u60A8\u5728 Jupyter \u6216 Colab \u7B14\u8BB0\u672C\u4E2D\u8FD0\u884C\u4EE3\u7801\uFF0C\u90A3\u4E48Gradio \u4F1A\u5C06\u6F14\u793A GUI \u5D4C\u5165\u5230\u7B14\u8BB0\u672C\u4E2D\uFF0C\u4EE5\u4FBF\u60A8\u8F7B\u677E\u4F7F\u7528\u5B83\u3002"),Es.forEach(s),Qt=u(e),H=r(e,"P",{});var vs=i(H);Qa=l(vs,"\u60A8\u53EF\u4EE5\u901A\u8FC7\u4E0D\u540C\u7684\u53C2\u6570\u81EA\u5B9A\u4E49 "),Ze=r(vs,"CODE",{});var So=i(Ze);Va=l(So,"launch()"),So.forEach(s),Xa=l(vs," \u7684\u884C\u4E3A\uFF1A"),vs.forEach(s),Vt=u(e),k=r(e,"UL",{});var je=i(k);_e=r(je,"LI",{});var Sl=i(_e);et=r(Sl,"CODE",{});var Fo=i(et);Za=l(Fo,"inline"),Fo.forEach(s),el=l(Sl," - whether to display the interface inline on Python notebooks."),Sl.forEach(s),tl=u(je),Ee=r(je,"LI",{});var Fl=i(Ee);tt=r(Fl,"CODE",{});var Mo=i(tt);sl=l(Mo,"inbrowser"),Mo.forEach(s),al=l(Fl," - whether to automatically launch the interface in a new tab on the default browser."),Fl.forEach(s),ll=u(je),ve=r(je,"LI",{});var Ml=i(ve);st=r(Ml,"CODE",{});var Ho=i(st);ol=l(Ho,"share"),Ho.forEach(s),rl=l(Ml," - whether to create a publicly shareable link from your computer for the interface. Kind of like a Google Drive link!"),Ml.forEach(s),je.forEach(s),Xt=u(e),U=r(e,"P",{});var bs=i(U);il=l(bs,"\u6211\u4EEC\u5C06\u5728\u4E0B\u4E00\u8282\u4E2D\u66F4\u8BE6\u7EC6\u5730\u4ECB\u7ECD "),at=r(bs,"CODE",{});var Uo=i(at);pl=l(Uo,"share"),Uo.forEach(s),nl=l(bs," \u53C2\u6570\uFF01"),bs.forEach(s),Zt=u(e),te=r(e,"H2",{id:!0});var Ro=i(te);cl=l(Ro,"\u270F\uFE0F \u8BA9\u6211\u4EEC\u5E94\u7528\u5B83\uFF01"),Ro.forEach(s),es=u(e),D=r(e,"P",{});var qe=i(D);ul=l(qe,"\u8BA9\u6211\u4EEC\u6784\u5EFA\u4E00\u4E2A\u754C\u9762\uFF0C\u8BA9\u60A8\u6F14\u793A "),lt=r(qe,"STRONG",{});var zo=i(lt);fl=l(zo,"speech-recognition"),zo.forEach(s),dl=l(qe,` \u6A21\u578B\u3002
\u4E3A\u4E86\u8BA9\u5B83\u53D8\u5F97\u6709\u8DA3\uFF0C\u6211\u4EEC\u5C06\u63A5\u53D7 `),ot=r(qe,"EM",{});var Bo=i(ot);ml=l(Bo,"or"),Bo.forEach(s),hl=l(qe," \u9EA6\u514B\u98CE\u8F93\u5165\u6216\u4E0A\u4F20\u7684\u6587\u4EF6\u3002"),qe.forEach(s),ts=u(e),m=r(e,"P",{});var w=i(m);_l=l(w,"\u50CF\u5F80\u5E38\u4E00\u6837\uFF0C\u6211\u4EEC\u5C06\u4F7F\u7528 \u{1F917} Transformers \u4E2D\u7684 "),rt=r(w,"CODE",{});var Jo=i(rt);El=l(Jo,"pipeline()"),Jo.forEach(s),vl=l(w," \u51FD\u6570\u52A0\u8F7D\u6211\u4EEC\u7684\u8BED\u97F3\u8BC6\u522B\u6A21\u578B\u3002\u5982\u679C\u60A8\u9700\u8981\u5FEB\u901F\u590D\u4E60\uFF0C\u60A8\u53EF\u4EE5\u8FD4\u56DE "),be=r(w,"A",{href:!0});var Ko=i(be);bl=l(Ko,"\u7B2C 1 \u7AE0\u4E2D\u7684\u90A3\u4E2A\u90E8\u5206"),Ko.forEach(s),yl=l(w,"\u3002 \u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u5C06\u5B9E\u73B0\u4E00\u4E2A "),it=r(w,"CODE",{});var Wo=i(it);wl=l(Wo,"transcribe_audio()"),Wo.forEach(s),jl=l(w," \u51FD\u6570\u6765\u5904\u7406\u97F3\u9891\u5E76\u8FD4\u56DE\u8F6C\u5F55\u3002 \u6700\u540E\uFF0C\u6211\u4EEC\u5C06\u628A\u8FD9\u4E2A\u51FD\u6570\u5305\u88C5\u5728\u4E00\u4E2A "),pt=r(w,"CODE",{});var Yo=i(pt);ql=l(Yo,"Interface"),Yo.forEach(s),kl=l(w," \u4E2D\uFF0C\u5176\u4E2D "),nt=r(w,"CODE",{});var Qo=i(nt);Dl=l(Qo,"Audio"),Qo.forEach(s),Cl=l(w," \u7EC4\u4EF6\u7528\u4E8E\u8F93\u5165\uFF0C\u53EA\u6709\u6587\u672C\u7528\u4E8E\u8F93\u51FA\u3002 \u603B\u800C\u8A00\u4E4B\uFF0C\u6B64\u5E94\u7528\u7A0B\u5E8F\u7684\u4EE3\u7801\u5982\u4E0B\uFF1A"),w.forEach(s),ss=u(e),mt(se.$$.fragment,e),as=u(e),R=r(e,"P",{});var ys=i(R);xl=l(ys,"\u5982\u679C\u60A8\u7684\u6D4F\u89C8\u5668\u6CA1\u6709\u8981\u6C42\u60A8\u63D0\u4F9B\u9EA6\u514B\u98CE\u6743\u9650\uFF0C"),ae=r(ys,"A",{href:!0,target:!0});var Vo=i(ae);$l=l(Vo,"open the demo in a separate tab"),Vo.forEach(s),Ol=l(ys,"."),ys.forEach(s),ls=u(e),v=r(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),i(v).forEach(s),os=u(e),C=r(e,"P",{});var ke=i(C);Pl=l(ke,`\u5C31\u662F\u8FD9\u6837\uFF01 \u60A8\u73B0\u5728\u53EF\u4EE5\u4F7F\u7528\u6B64\u754C\u9762\u6765\u8F6C\u5F55\u97F3\u9891\u3002 \u6CE8\u610F\u8FD9\u91CC
\u901A\u8FC7\u5C06 `),ct=r(ke,"CODE",{});var Xo=i(ct);Al=l(Xo,"optional"),Xo.forEach(s),Il=l(ke," \u53C2\u6570\u4F5C\u4E3A "),ut=r(ke,"CODE",{});var Zo=i(ut);Gl=l(Zo,"True"),Zo.forEach(s),Nl=l(ke,` \u4F20\u9012\uFF0C\u6211\u4EEC\u5141\u8BB8\u7528\u6237
\u63D0\u4F9B\u9EA6\u514B\u98CE\u6216\u97F3\u9891\u6587\u4EF6\uFF08\u6216\u4E24\u8005\u90FD\u4E0D\u63D0\u4F9B\uFF0C\u4F46\u8FD9\u4F1A\u8FD4\u56DE\u9519\u8BEF\u6D88\u606F\uFF09\u3002`),ke.forEach(s),rs=u(e),ye=r(e,"P",{});var er=i(ye);Ll=l(er,"\u7EE7\u7EED\u770B\u770B\u5982\u4F55\u4E0E\u4ED6\u4EBA\u5206\u4EAB\u60A8\u7684\u754C\u9762\uFF01"),er.forEach(s),this.h()},h(){f($,"name","hf:doc:metadata"),f($,"content",JSON.stringify(cr)),f(B,"id",""),f(K,"id",""),f(W,"href","https://gradio.app/docs"),f(W,"rel","nofollow"),f(pe,"href","/course/chapter9/2"),f(Y,"id",""),f(V,"href","https://huggingface.co/spaces/course-demos/audio-reverse"),f(V,"target","_blank"),Hl(_.src,zl="https://hf.space/gradioiframe/course-demos/audio-reverse/+")||f(_,"src",zl),f(_,"frameborder","0"),f(_,"height","250"),f(_,"title","Gradio app"),f(_,"class","container p-0 flex-grow space-iframe"),f(_,"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"),f(_,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),f(X,"id",""),Hl(E.src,Bl="https://hf.space/gradioiframe/course-demos/generate-tone/+")||f(E,"src",Bl),f(E,"frameborder","0"),f(E,"height","450"),f(E,"title","Gradio app"),f(E,"class","container p-0 flex-grow space-iframe"),f(E,"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"),f(E,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),f(S,"id","launch"),f(S,"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"),f(S,"href","#launch"),f(O,"class","relative group"),f(te,"id",""),f(be,"href","/course/chapter1/3"),f(ae,"href","https://huggingface.co/spaces/course-demos/audio-reverse"),f(ae,"target","_blank"),Hl(v.src,Jl="https://hf.space/gradioiframe/course-demos/asr/+")||f(v,"src",Jl),f(v,"frameborder","0"),f(v,"height","550"),f(v,"title","Gradio app"),f(v,"class","container p-0 flex-grow space-iframe"),f(v,"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"),f(v,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads")},m(e,p){t(document.head,$),n(e,bt,p),n(e,B,p),t(B,ws),n(e,yt,p),ht(J,e,p),n(e,wt,p),n(e,P,p),t(P,js),t(P,De),t(De,qs),t(P,ks),n(e,jt,p),n(e,K,p),t(K,Ds),n(e,qt,p),n(e,A,p),t(A,Cs),t(A,Ce),t(Ce,xs),t(A,$s),n(e,kt,p),n(e,oe,p),t(oe,xe),t(xe,Os),n(e,Dt,p),n(e,re,p),t(re,Ps),n(e,Ct,p),n(e,j,p),t(j,ie),t(ie,$e),t($e,As),t(ie,Is),t(j,Gs),t(j,q),t(q,Oe),t(Oe,Ns),t(q,Ls),t(q,Pe),t(Pe,Ts),t(q,gs),t(q,Ae),t(Ae,Ss),t(q,Fs),t(j,Ms),t(j,I),t(I,Ie),t(Ie,Hs),t(I,Us),t(I,Ge),t(Ge,Rs),t(I,zs),n(e,xt,p),n(e,G,p),t(G,Bs),t(G,W),t(W,Js),t(G,Ks),n(e,$t,p),n(e,d,p),t(d,Ws),t(d,pe),t(pe,Ys),t(d,Qs),t(d,Ne),t(Ne,Vs),t(d,Xs),t(d,Le),t(Le,Zs),t(d,ea),t(d,Te),t(Te,ta),t(d,sa),t(d,ge),t(ge,aa),t(d,la),n(e,Ot,p),n(e,Y,p),t(Y,oa),n(e,Pt,p),n(e,ne,p),t(ne,ra),n(e,At,p),n(e,ce,p),t(ce,ia),n(e,It,p),n(e,b,p),t(b,pa),t(b,Se),t(Se,na),t(b,ca),t(b,Fe),t(Fe,ua),t(b,fa),t(b,Me),t(Me,da),t(b,ma),n(e,Gt,p),n(e,h,p),t(h,ha),t(h,He),t(He,_a),t(h,Ea),t(h,Ue),t(Ue,va),t(h,ba),t(h,Re),t(Re,ya),t(h,wa),t(h,ze),t(ze,ja),t(h,qa),n(e,Nt,p),n(e,N,p),t(N,ka),t(N,Be),t(Be,Da),t(N,Ca),n(e,Lt,p),ht(Q,e,p),n(e,Tt,p),n(e,L,p),t(L,xa),t(L,V),t(V,$a),t(L,Oa),n(e,gt,p),n(e,_,p),n(e,St,p),n(e,ue,p),t(ue,Pa),n(e,Ft,p),n(e,X,p),t(X,Aa),n(e,Mt,p),n(e,fe,p),t(fe,Ia),n(e,Ht,p),n(e,de,p),t(de,Ga),n(e,Ut,p),n(e,me,p),t(me,Na),n(e,Rt,p),n(e,T,p),t(T,Je),t(Je,La),t(T,Ta),t(T,Ke),t(Ke,ga),n(e,zt,p),n(e,g,p),t(g,Sa),t(g,We),t(We,Fa),t(g,Ma),n(e,Bt,p),ht(Z,e,p),n(e,Jt,p),n(e,E,p),n(e,Kt,p),n(e,O,p),t(O,S),t(S,Ye),ht(ee,Ye,null),t(O,Ha),t(O,he),t(he,Qe),t(Qe,Ua),t(he,Ra),n(e,Wt,p),n(e,F,p),t(F,za),t(F,Ve),t(Ve,Ba),t(F,Ja),n(e,Yt,p),n(e,M,p),t(M,Ka),t(M,Xe),t(Xe,Wa),t(M,Ya),n(e,Qt,p),n(e,H,p),t(H,Qa),t(H,Ze),t(Ze,Va),t(H,Xa),n(e,Vt,p),n(e,k,p),t(k,_e),t(_e,et),t(et,Za),t(_e,el),t(k,tl),t(k,Ee),t(Ee,tt),t(tt,sl),t(Ee,al),t(k,ll),t(k,ve),t(ve,st),t(st,ol),t(ve,rl),n(e,Xt,p),n(e,U,p),t(U,il),t(U,at),t(at,pl),t(U,nl),n(e,Zt,p),n(e,te,p),t(te,cl),n(e,es,p),n(e,D,p),t(D,ul),t(D,lt),t(lt,fl),t(D,dl),t(D,ot),t(ot,ml),t(D,hl),n(e,ts,p),n(e,m,p),t(m,_l),t(m,rt),t(rt,El),t(m,vl),t(m,be),t(be,bl),t(m,yl),t(m,it),t(it,wl),t(m,jl),t(m,pt),t(pt,ql),t(m,kl),t(m,nt),t(nt,Dl),t(m,Cl),n(e,ss,p),ht(se,e,p),n(e,as,p),n(e,R,p),t(R,xl),t(R,ae),t(ae,$l),t(R,Ol),n(e,ls,p),n(e,v,p),n(e,os,p),n(e,C,p),t(C,Pl),t(C,ct),t(ct,Al),t(C,Il),t(C,ut),t(ut,Gl),t(C,Nl),n(e,rs,p),n(e,ye,p),t(ye,Ll),is=!0},p:or,i(e){is||(_t(J.$$.fragment,e),_t(Q.$$.fragment,e),_t(Z.$$.fragment,e),_t(ee.$$.fragment,e),_t(se.$$.fragment,e),is=!0)},o(e){Et(J.$$.fragment,e),Et(Q.$$.fragment,e),Et(Z.$$.fragment,e),Et(ee.$$.fragment,e),Et(se.$$.fragment,e),is=!1},d(e){s($),e&&s(bt),e&&s(B),e&&s(yt),vt(J,e),e&&s(wt),e&&s(P),e&&s(jt),e&&s(K),e&&s(qt),e&&s(A),e&&s(kt),e&&s(oe),e&&s(Dt),e&&s(re),e&&s(Ct),e&&s(j),e&&s(xt),e&&s(G),e&&s($t),e&&s(d),e&&s(Ot),e&&s(Y),e&&s(Pt),e&&s(ne),e&&s(At),e&&s(ce),e&&s(It),e&&s(b),e&&s(Gt),e&&s(h),e&&s(Nt),e&&s(N),e&&s(Lt),vt(Q,e),e&&s(Tt),e&&s(L),e&&s(gt),e&&s(_),e&&s(St),e&&s(ue),e&&s(Ft),e&&s(X),e&&s(Mt),e&&s(fe),e&&s(Ht),e&&s(de),e&&s(Ut),e&&s(me),e&&s(Rt),e&&s(T),e&&s(zt),e&&s(g),e&&s(Bt),vt(Z,e),e&&s(Jt),e&&s(E),e&&s(Kt),e&&s(O),vt(ee),e&&s(Wt),e&&s(F),e&&s(Yt),e&&s(M),e&&s(Qt),e&&s(H),e&&s(Vt),e&&s(k),e&&s(Xt),e&&s(U),e&&s(Zt),e&&s(te),e&&s(es),e&&s(D),e&&s(ts),e&&s(m),e&&s(ss),vt(se,e),e&&s(as),e&&s(R),e&&s(ls),e&&s(v),e&&s(os),e&&s(C),e&&s(rs),e&&s(ye)}}}const cr={local:"",sections:[{local:"",title:"\u5982\u4F55\u521B\u5EFA\u63A5\u53E3"},{local:"",title:"\u4E00\u4E2A\u5E26\u97F3\u9891\u7684\u7B80\u5355\u793A\u4F8B"},{local:"",sections:[{local:"launch",title:"`launch()` \u65B9\u6CD5"}],title:"\u5904\u7406\u591A\u4E2A\u8F93\u5165\u548C\u8F93\u51FA"},{local:"",title:"\u270F\uFE0F \u8BA9\u6211\u4EEC\u5E94\u7528\u5B83\uFF01"}],title:"\u4E86\u89E3\u63A5\u53E3\u7C7B"};function ur(Rl){return rr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _r extends tr{constructor($){super();sr(this,$,ur,nr,ar,{})}}export{_r as default,cr as metadata};
