import{s as nt,a as at,n as it,o as ot}from"../chunks/scheduler.cc52f4b9.js";import{S as pt,i as ct,e as i,s as a,c as m,h as rt,a as o,d as l,b as n,f as We,g as u,j as p,k as c,l as Mt,m as s,n as y,t as d,o as J,p as T}from"../chunks/index.9480bb2b.js";import{C as mt,H as P,E as ut}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.009dc98d.js";import{Y as yt}from"../chunks/Youtube.7b12d9e8.js";import{C as Ze}from"../chunks/CodeBlock.184aadb6.js";import{D as dt}from"../chunks/DocNotebookDropdown.6e3674fe.js";function Jt(Qe){let U,O,D,ee,w,te,b,le,g,se,j,He="现在你已经构建了一个演示，你可能希望将其分享给你的同事或者朋友一起体验一下。Gradio 演示可以通过两种方式进行分享：使用 <strong>临时的共享链接</strong> 或者 <strong>在 Spaces 上永久托管</strong>。",ae,f,Ye="我们将稍后快速介绍这两种方法。但在分享演示之前，你可能需要完善它 💅。",ne,C,ie,h,Fe='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter9/gradio-demo-overview.png" alt="Overview of a gradio interface"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter9/gradio-demo-overview-dark.png" alt="Overview of a gradio interface"/>',oe,I,ze="为了使演示使用起来更清晰， <code>Interface</code> 类支持一些可选参数：",pe,k,_e="<li><code>title</code> ：你可以给你的演示创建一个标题，它将显示在输入和输出组件的上方。</li> <li><code>description</code> ：你可以为界面提供描述（以文本、Markdown 或 HTML 形式），显示在输入和输出组件的上方和标题下方。</li> <li><code>article</code> ：你还可以编写扩展的文章（以文本、Markdown 或 HTML 形式）来解释界面。如果提供，它会出现在输入和输出组件的下方。</li> <li><code>theme</code> ：如果不喜欢默认颜色？你可以将主题可以设置为 <code>default</code> 、 <code>huggingface</code> 、 <code>grass</code> 、 <code>peach</code> 之一。同时你还可以添加 <code>dark-</code> 前缀，例如 <code>dark-peach</code> 用于深色主题（或者仅使用 <code>dark</code> 表示默认的深色主题）。</li> <li><code>examples</code> ：为了让你的演示更易于使用，你可以为函数提供一些示例输入。它们出现在 UI 组件下方，点击后可以自动填充到输入和输出。示例的格式应该是多层的列表，外层列表包含每个示例，每个内层的列表包含与每个输入组件对应的输入。</li> <li><code>live</code> ：如果你想使你的演示“实时”反馈，即每次输入更改时自动重新运行模型，你可以设置 <code>live=True</code> 。这对运行比较快的模型很有意义（我们将在本节末尾看到一个示例）</li>",ce,v,Le="完善上述选项后，我们就得到了一个更完整的界面。运行以下代码，你可以与 Rick 和 Morty 进行对话：",re,B,Me,G,Ee="使用上面的选项，我们最终得到了一个更完整的界面。试试下面的界面：",me,r,Ne,ue,$,ye,R,Ve=`现在我们已经有了机器学习模型的工作演示，接下来将学习如何轻松地通过链接将演示共享给其他人。
通过在 <code>launch()</code> 方法中设置 <code>share=True</code> 可以就轻松地公开共享接口：`,de,S,Je,x,qe="运行上面的代码会生成一个公开的、可共享的链接，你可以将其发送给任何人！得到此链接的用户可以在浏览器中试用该模型，时间长达 72 小时，时间长达 72 小时。因为处理发生在运行代码的设备上（设备需保持开启），所以无须打包任何依赖项。如果你使用 Google Colab 笔记本工作，则默认会自动创建共享链接。它通常看起来像这样：<strong>XXXXX.gradio.app</strong>。虽然链接是通过 Gradio 链接提供的，但 Gradio 只是提供了一个本地服务器的代理，不会存储通过接口发送的任何数据。",Te,W,Xe="但是请记住，这些链接是可公开访问的，这意味着任何人都可以使用你的模型进行预测！因此，请确保不要使用你编写的函数公开任何敏感信息，也不要允许其中的代码对你的设备进行任何重要更改。如果设置 <code>share=False</code> （默认值就是False），则仅创建本地链接。",Ue,Z,he,Q,Ae="可以传递给同事的共享链接很酷，但是如何在互联网上永久托管你的演示并使其具有自己的“space”呢？",we,H,De='Hugging Face Spaces 提供了在互联网上永久托管你的 Gradio 模型的基础设施， 并且 <strong>完全免费</strong> ！你可以将你创建 Space 推送到（公共或私有）仓库，在其中，你的 Gradio 界面代码需要存储在一个 <code>app.py</code> 文件中。 请 <a href="https://huggingface.co/blog/gradio-spaces" rel="nofollow">阅读分步教程</a> 开始使用 Hugging Face Spaces ，或观看下面的示例视频。',be,Y,ge,F,je,z,Ke='现在，让我们使用到目前为止我们在各节中学到的知识，尝试创建我们在 <a href="/course/chapter9/1">本章第一节</a> 中看到的草图识别演示。我们会在界面中添加一些自定义配置并设置 <code>share=True</code> 以创建一个可以与其他人共享的链接。',fe,_,Pe='首先，我们可以从 <a href="https://huggingface.co/spaces/dawood/Sketch-Recognition/blob/main/class_names.txt" rel="nofollow">class_names.txt</a> 加载标签，并从 <a href="https://huggingface.co/spaces/dawood/Sketch-Recognition/blob/main/pytorch_model.bin" rel="nofollow">pytorch_model.bin</a> 加载预训练的 pytorch 模型。通过点击链接并点击文件预览左上角的下载来下载这些文件。然后使用下面的代码加载模型并创建一个 <code>predict()</code> 函数：',Ce,L,Ie,E,Oe="现在我们有了一个 <code>predict()</code> 函数。下一步是设置并启动我们的 gradio 界面：",ke,N,ve,M,et,Be,V,tt="注意 <code>Interface</code> 中设置了 <code>live=True</code> 参数，这意味着每当有人在画板上绘制时，草图演示都会实时进行预测（无需点击提交按钮！）。",Ge,q,lt="此外，我们还在 <code>launch()</code> 方法中设置了 <code>share=True</code> 参数。这将创建一个公共链接，你可以发送给任何人！当你发送此链接时，对方可以尝试草图识别模型。重申一下，你还可以在 Hugging Face Spaces 上托管模型，这也是本教程中我们在网页上展示演示的方式。",$e,X,st="接下来，我们将学习将 Gradio 与 Hugging Face 生态系统结合的其他用法！",Re,A,Se,K,xe;return w=new mt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),b=new P({props:{title:"与他人分享演示",local:"与他人分享演示",headingTag:"h1"}}),g=new dt({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"}]}}),C=new P({props:{title:"打磨你的 Gradio 演示：",local:"打磨你的 Gradio 演示:",headingTag:"h3"}}),B=new Ze({props:{code:"dGl0bGUlMjAlM0QlMjAlMjJBc2slMjBSaWNrJTIwYSUyMFF1ZXN0aW9uJTIyJTBBZGVzY3JpcHRpb24lMjAlM0QlMjAlMjIlMjIlMjIlMEFUaGUlMjBib3QlMjB3YXMlMjB0cmFpbmVkJTIwdG8lMjBhbnN3ZXIlMjBxdWVzdGlvbnMlMjBiYXNlZCUyMG9uJTIwUmljayUyMGFuZCUyME1vcnR5JTIwZGlhbG9ndWVzLiUyMEFzayUyMFJpY2slMjBhbnl0aGluZyElMEElM0NpbWclMjBzcmMlM0QlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGc3BhY2VzJTJGY291cnNlLWRlbW9zJTJGUmlja19hbmRfTW9ydHlfUUElMkZyZXNvbHZlJTJGbWFpbiUyRnJpY2sucG5nJTIyJTIwd2lkdGglM0QyMDBweCUzRSUwQSUyMiUyMiUyMiUwQSUwQWFydGljbGUlMjAlM0QlMjAlMjJDaGVjayUyMG91dCUyMCU1QnRoZSUyMG9yaWdpbmFsJTIwUmljayUyMGFuZCUyME1vcnR5JTIwQm90JTVEKGh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZzcGFjZXMlMkZraW5nYWJ6cHJvJTJGUmlja19hbmRfTW9ydHlfQm90KSUyMHRoYXQlMjB0aGlzJTIwZGVtbyUyMGlzJTIwYmFzZWQlMjBvZmYlMjBvZi4lMjIlMEElMEFnci5JbnRlcmZhY2UoJTBBJTIwJTIwJTIwJTIwZm4lM0RwcmVkaWN0JTJDJTBBJTIwJTIwJTIwJTIwaW5wdXRzJTNEJTIydGV4dGJveCUyMiUyQyUwQSUyMCUyMCUyMCUyMG91dHB1dHMlM0QlMjJ0ZXh0JTIyJTJDJTBBJTIwJTIwJTIwJTIwdGl0bGUlM0R0aXRsZSUyQyUwQSUyMCUyMCUyMCUyMGRlc2NyaXB0aW9uJTNEZGVzY3JpcHRpb24lMkMlMEElMjAlMjAlMjAlMjBhcnRpY2xlJTNEYXJ0aWNsZSUyQyUwQSUyMCUyMCUyMCUyMGV4YW1wbGVzJTNEJTVCJTVCJTIyV2hhdCUyMGFyZSUyMHlvdSUyMGRvaW5nJTNGJTIyJTVEJTJDJTIwJTVCJTIyV2hlcmUlMjBzaG91bGQlMjB3ZSUyMHRpbWUlMjB0cmF2ZWwlMjB0byUzRiUyMiU1RCU1RCUyQyUwQSkubGF1bmNoKCk=",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()`,wrap:!1}}),$=new P({props:{title:"使用临时链接分享你的演示",local:"使用临时链接分享你的演示",headingTag:"h3"}}),S=new Ze({props:{code:"Z3IuSW50ZXJmYWNlKGNsYXNzaWZ5X2ltYWdlJTJDJTIwJTIyaW1hZ2UlMjIlMkMlMjAlMjJsYWJlbCUyMikubGF1bmNoKHNoYXJlJTNEVHJ1ZSk=",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>)',wrap:!1}}),Z=new P({props:{title:"在 Hugging Face Spaces 上托管你的演示",local:"在 Hugging Face Spaces 上托管你的演示",headingTag:"h3"}}),Y=new yt({props:{id:"LS9Y2wDVI0k"}}),F=new P({props:{title:"✏️ 让我们实现它！",local:"✏️ 让我们实现它!",headingTag:"h2"}}),L=new Ze({props:{code:"ZnJvbSUyMHBhdGhsaWIlMjBpbXBvcnQlMjBQYXRoJTBBaW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBncmFkaW8lMjBhcyUyMGdyJTBBZnJvbSUyMHRvcmNoJTIwaW1wb3J0JTIwbm4lMEElMEFMQUJFTFMlMjAlM0QlMjBQYXRoKCUyMmNsYXNzX25hbWVzLnR4dCUyMikucmVhZF90ZXh0KCkuc3BsaXRsaW5lcygpJTBBJTBBbW9kZWwlMjAlM0QlMjBubi5TZXF1ZW50aWFsKCUwQSUyMCUyMCUyMCUyMG5uLkNvbnYyZCgxJTJDJTIwMzIlMkMlMjAzJTJDJTIwcGFkZGluZyUzRCUyMnNhbWUlMjIpJTJDJTBBJTIwJTIwJTIwJTIwbm4uUmVMVSgpJTJDJTBBJTIwJTIwJTIwJTIwbm4uTWF4UG9vbDJkKDIpJTJDJTBBJTIwJTIwJTIwJTIwbm4uQ29udjJkKDMyJTJDJTIwNjQlMkMlMjAzJTJDJTIwcGFkZGluZyUzRCUyMnNhbWUlMjIpJTJDJTBBJTIwJTIwJTIwJTIwbm4uUmVMVSgpJTJDJTBBJTIwJTIwJTIwJTIwbm4uTWF4UG9vbDJkKDIpJTJDJTBBJTIwJTIwJTIwJTIwbm4uQ29udjJkKDY0JTJDJTIwMTI4JTJDJTIwMyUyQyUyMHBhZGRpbmclM0QlMjJzYW1lJTIyKSUyQyUwQSUyMCUyMCUyMCUyMG5uLlJlTFUoKSUyQyUwQSUyMCUyMCUyMCUyMG5uLk1heFBvb2wyZCgyKSUyQyUwQSUyMCUyMCUyMCUyMG5uLkZsYXR0ZW4oKSUyQyUwQSUyMCUyMCUyMCUyMG5uLkxpbmVhcigxMTUyJTJDJTIwMjU2KSUyQyUwQSUyMCUyMCUyMCUyMG5uLlJlTFUoKSUyQyUwQSUyMCUyMCUyMCUyMG5uLkxpbmVhcigyNTYlMkMlMjBsZW4oTEFCRUxTKSklMkMlMEEpJTBBc3RhdGVfZGljdCUyMCUzRCUyMHRvcmNoLmxvYWQoJTIycHl0b3JjaF9tb2RlbC5iaW4lMjIlMkMlMjBtYXBfbG9jYXRpb24lM0QlMjJjcHUlMjIpJTBBbW9kZWwubG9hZF9zdGF0ZV9kaWN0KHN0YXRlX2RpY3QlMkMlMjBzdHJpY3QlM0RGYWxzZSklMEFtb2RlbC5ldmFsKCklMEElMEElMEFkZWYlMjBwcmVkaWN0KGltKSUzQSUwQSUyMCUyMCUyMCUyMHglMjAlM0QlMjB0b3JjaC50ZW5zb3IoaW0lMkMlMjBkdHlwZSUzRHRvcmNoLmZsb2F0MzIpLnVuc3F1ZWV6ZSgwKS51bnNxdWVlemUoMCklMjAlMkYlMjAyNTUuMCUwQSUyMCUyMCUyMCUyMHdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvdXQlMjAlM0QlMjBtb2RlbCh4KSUwQSUyMCUyMCUyMCUyMHByb2JhYmlsaXRpZXMlMjAlM0QlMjB0b3JjaC5ubi5mdW5jdGlvbmFsLnNvZnRtYXgob3V0JTVCMCU1RCUyQyUyMGRpbSUzRDApJTBBJTIwJTIwJTIwJTIwdmFsdWVzJTJDJTIwaW5kaWNlcyUyMCUzRCUyMHRvcmNoLnRvcGsocHJvYmFiaWxpdGllcyUyQyUyMDUpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTdCTEFCRUxTJTVCaSU1RCUzQSUyMHYuaXRlbSgpJTIwZm9yJTIwaSUyQyUyMHYlMjBpbiUyMHppcChpbmRpY2VzJTJDJTIwdmFsdWVzKSU3RA==",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)}`,wrap:!1}}),N=new Ze({props:{code:"aW50ZXJmYWNlJTIwJTNEJTIwZ3IuSW50ZXJmYWNlKCUwQSUyMCUyMCUyMCUyMHByZWRpY3QlMkMlMEElMjAlMjAlMjAlMjBpbnB1dHMlM0QlMjJza2V0Y2hwYWQlMjIlMkMlMEElMjAlMjAlMjAlMjBvdXRwdXRzJTNEJTIybGFiZWwlMjIlMkMlMEElMjAlMjAlMjAlMjB0aGVtZSUzRCUyMmh1Z2dpbmdmYWNlJTIyJTJDJTBBJTIwJTIwJTIwJTIwdGl0bGUlM0QlMjJTa2V0Y2glMjBSZWNvZ25pdGlvbiUyMiUyQyUwQSUyMCUyMCUyMCUyMGRlc2NyaXB0aW9uJTNEJTIyV2hvJTIwd2FudHMlMjB0byUyMHBsYXklMjBQaWN0aW9uYXJ5JTNGJTIwRHJhdyUyMGElMjBjb21tb24lMjBvYmplY3QlMjBsaWtlJTIwYSUyMHNob3ZlbCUyMG9yJTIwYSUyMGxhcHRvcCUyQyUyMGFuZCUyMHRoZSUyMGFsZ29yaXRobSUyMHdpbGwlMjBndWVzcyUyMGluJTIwcmVhbCUyMHRpbWUhJTIyJTJDJTBBJTIwJTIwJTIwJTIwYXJ0aWNsZSUzRCUyMiUzQ3AlMjBzdHlsZSUzRCd0ZXh0LWFsaWduJTNBJTIwY2VudGVyJyUzRVNrZXRjaCUyMFJlY29nbml0aW9uJTIwJTdDJTIwRGVtbyUyME1vZGVsJTNDJTJGcCUzRSUyMiUyQyUwQSUyMCUyMCUyMCUyMGxpdmUlM0RUcnVlJTJDJTBBKSUwQWludGVyZmFjZS5sYXVuY2goc2hhcmUlM0RUcnVlKQ==",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>)`,wrap:!1}}),A=new ut({props:{source:"https://github.com/huggingface/course/blob/main/chapters/zh-CN/chapter9/4.mdx"}}),{c(){U=i("meta"),O=a(),D=i("p"),ee=a(),m(w.$$.fragment),te=a(),m(b.$$.fragment),le=a(),m(g.$$.fragment),se=a(),j=i("p"),j.innerHTML=He,ae=a(),f=i("p"),f.textContent=Ye,ne=a(),m(C.$$.fragment),ie=a(),h=i("div"),h.innerHTML=Fe,oe=a(),I=i("p"),I.innerHTML=ze,pe=a(),k=i("ul"),k.innerHTML=_e,ce=a(),v=i("p"),v.textContent=Le,re=a(),m(B.$$.fragment),Me=a(),G=i("p"),G.textContent=Ee,me=a(),r=i("iframe"),ue=a(),m($.$$.fragment),ye=a(),R=i("p"),R.innerHTML=Ve,de=a(),m(S.$$.fragment),Je=a(),x=i("p"),x.innerHTML=qe,Te=a(),W=i("p"),W.innerHTML=Xe,Ue=a(),m(Z.$$.fragment),he=a(),Q=i("p"),Q.textContent=Ae,we=a(),H=i("p"),H.innerHTML=De,be=a(),m(Y.$$.fragment),ge=a(),m(F.$$.fragment),je=a(),z=i("p"),z.innerHTML=Ke,fe=a(),_=i("p"),_.innerHTML=Pe,Ce=a(),m(L.$$.fragment),Ie=a(),E=i("p"),E.innerHTML=Oe,ke=a(),m(N.$$.fragment),ve=a(),M=i("iframe"),Be=a(),V=i("p"),V.innerHTML=tt,Ge=a(),q=i("p"),q.innerHTML=lt,$e=a(),X=i("p"),X.textContent=st,Re=a(),m(A.$$.fragment),Se=a(),K=i("p"),this.h()},l(e){const t=rt("svelte-u9bgzb",document.head);U=o(t,"META",{name:!0,content:!0}),t.forEach(l),O=n(e),D=o(e,"P",{}),We(D).forEach(l),ee=n(e),u(w.$$.fragment,e),te=n(e),u(b.$$.fragment,e),le=n(e),u(g.$$.fragment,e),se=n(e),j=o(e,"P",{"data-svelte-h":!0}),p(j)!=="svelte-1k6pdv1"&&(j.innerHTML=He),ae=n(e),f=o(e,"P",{"data-svelte-h":!0}),p(f)!=="svelte-hs82yr"&&(f.textContent=Ye),ne=n(e),u(C.$$.fragment,e),ie=n(e),h=o(e,"DIV",{class:!0,"data-svelte-h":!0}),p(h)!=="svelte-nclpfp"&&(h.innerHTML=Fe),oe=n(e),I=o(e,"P",{"data-svelte-h":!0}),p(I)!=="svelte-9x26ex"&&(I.innerHTML=ze),pe=n(e),k=o(e,"UL",{"data-svelte-h":!0}),p(k)!=="svelte-1onbbxv"&&(k.innerHTML=_e),ce=n(e),v=o(e,"P",{"data-svelte-h":!0}),p(v)!=="svelte-uxvbg4"&&(v.textContent=Le),re=n(e),u(B.$$.fragment,e),Me=n(e),G=o(e,"P",{"data-svelte-h":!0}),p(G)!=="svelte-3ql1h0"&&(G.textContent=Ee),me=n(e),r=o(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),We(r).forEach(l),ue=n(e),u($.$$.fragment,e),ye=n(e),R=o(e,"P",{"data-svelte-h":!0}),p(R)!=="svelte-zkbnhm"&&(R.innerHTML=Ve),de=n(e),u(S.$$.fragment,e),Je=n(e),x=o(e,"P",{"data-svelte-h":!0}),p(x)!=="svelte-75ozpw"&&(x.innerHTML=qe),Te=n(e),W=o(e,"P",{"data-svelte-h":!0}),p(W)!=="svelte-ks1rmr"&&(W.innerHTML=Xe),Ue=n(e),u(Z.$$.fragment,e),he=n(e),Q=o(e,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-676vzv"&&(Q.textContent=Ae),we=n(e),H=o(e,"P",{"data-svelte-h":!0}),p(H)!=="svelte-1qf7ss4"&&(H.innerHTML=De),be=n(e),u(Y.$$.fragment,e),ge=n(e),u(F.$$.fragment,e),je=n(e),z=o(e,"P",{"data-svelte-h":!0}),p(z)!=="svelte-1gjyjxr"&&(z.innerHTML=Ke),fe=n(e),_=o(e,"P",{"data-svelte-h":!0}),p(_)!=="svelte-1gmyh7w"&&(_.innerHTML=Pe),Ce=n(e),u(L.$$.fragment,e),Ie=n(e),E=o(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-1gdfqy7"&&(E.innerHTML=Oe),ke=n(e),u(N.$$.fragment,e),ve=n(e),M=o(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),We(M).forEach(l),Be=n(e),V=o(e,"P",{"data-svelte-h":!0}),p(V)!=="svelte-oyxxc5"&&(V.innerHTML=tt),Ge=n(e),q=o(e,"P",{"data-svelte-h":!0}),p(q)!=="svelte-1po2b7v"&&(q.innerHTML=lt),$e=n(e),X=o(e,"P",{"data-svelte-h":!0}),p(X)!=="svelte-qiff2f"&&(X.textContent=st),Re=n(e),u(A.$$.fragment,e),Se=n(e),K=o(e,"P",{}),We(K).forEach(l),this.h()},h(){c(U,"name","hf:doc:metadata"),c(U,"content",Tt),c(h,"class","flex justify-center"),at(r.src,Ne="https://course-demos-Rick-and-Morty-QA.hf.space")||c(r,"src",Ne),c(r,"frameborder","0"),c(r,"height","800"),c(r,"title","Gradio app"),c(r,"class","container p-0 flex-grow space-iframe"),c(r,"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"),c(r,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),at(M.src,et="https://course-demos-Sketch-Recognition.hf.space")||c(M,"src",et),c(M,"frameborder","0"),c(M,"height","650"),c(M,"title","Gradio app"),c(M,"class","container p-0 flex-grow space-iframe"),c(M,"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"),c(M,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads")},m(e,t){Mt(document.head,U),s(e,O,t),s(e,D,t),s(e,ee,t),y(w,e,t),s(e,te,t),y(b,e,t),s(e,le,t),y(g,e,t),s(e,se,t),s(e,j,t),s(e,ae,t),s(e,f,t),s(e,ne,t),y(C,e,t),s(e,ie,t),s(e,h,t),s(e,oe,t),s(e,I,t),s(e,pe,t),s(e,k,t),s(e,ce,t),s(e,v,t),s(e,re,t),y(B,e,t),s(e,Me,t),s(e,G,t),s(e,me,t),s(e,r,t),s(e,ue,t),y($,e,t),s(e,ye,t),s(e,R,t),s(e,de,t),y(S,e,t),s(e,Je,t),s(e,x,t),s(e,Te,t),s(e,W,t),s(e,Ue,t),y(Z,e,t),s(e,he,t),s(e,Q,t),s(e,we,t),s(e,H,t),s(e,be,t),y(Y,e,t),s(e,ge,t),y(F,e,t),s(e,je,t),s(e,z,t),s(e,fe,t),s(e,_,t),s(e,Ce,t),y(L,e,t),s(e,Ie,t),s(e,E,t),s(e,ke,t),y(N,e,t),s(e,ve,t),s(e,M,t),s(e,Be,t),s(e,V,t),s(e,Ge,t),s(e,q,t),s(e,$e,t),s(e,X,t),s(e,Re,t),y(A,e,t),s(e,Se,t),s(e,K,t),xe=!0},p:it,i(e){xe||(d(w.$$.fragment,e),d(b.$$.fragment,e),d(g.$$.fragment,e),d(C.$$.fragment,e),d(B.$$.fragment,e),d($.$$.fragment,e),d(S.$$.fragment,e),d(Z.$$.fragment,e),d(Y.$$.fragment,e),d(F.$$.fragment,e),d(L.$$.fragment,e),d(N.$$.fragment,e),d(A.$$.fragment,e),xe=!0)},o(e){J(w.$$.fragment,e),J(b.$$.fragment,e),J(g.$$.fragment,e),J(C.$$.fragment,e),J(B.$$.fragment,e),J($.$$.fragment,e),J(S.$$.fragment,e),J(Z.$$.fragment,e),J(Y.$$.fragment,e),J(F.$$.fragment,e),J(L.$$.fragment,e),J(N.$$.fragment,e),J(A.$$.fragment,e),xe=!1},d(e){e&&(l(O),l(D),l(ee),l(te),l(le),l(se),l(j),l(ae),l(f),l(ne),l(ie),l(h),l(oe),l(I),l(pe),l(k),l(ce),l(v),l(re),l(Me),l(G),l(me),l(r),l(ue),l(ye),l(R),l(de),l(Je),l(x),l(Te),l(W),l(Ue),l(he),l(Q),l(we),l(H),l(be),l(ge),l(je),l(z),l(fe),l(_),l(Ce),l(Ie),l(E),l(ke),l(ve),l(M),l(Be),l(V),l(Ge),l(q),l($e),l(X),l(Re),l(Se),l(K)),l(U),T(w,e),T(b,e),T(g,e),T(C,e),T(B,e),T($,e),T(S,e),T(Z,e),T(Y,e),T(F,e),T(L,e),T(N,e),T(A,e)}}}const Tt='{"title":"与他人分享演示","local":"与他人分享演示","sections":[{"title":"打磨你的 Gradio 演示：","local":"打磨你的 Gradio 演示:","sections":[],"depth":3},{"title":"使用临时链接分享你的演示","local":"使用临时链接分享你的演示","sections":[],"depth":3},{"title":"在 Hugging Face Spaces 上托管你的演示","local":"在 Hugging Face Spaces 上托管你的演示","sections":[],"depth":3},{"title":"✏️ 让我们实现它！","local":"✏️ 让我们实现它!","sections":[],"depth":2}],"depth":1}';function Ut(Qe){return ot(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ct extends pt{constructor(U){super(),ct(this,U,Ut,Jt,nt,{})}}export{Ct as component};
