import{S as ca,i as pa,s as ga,e,k as p,w as z,t as r,M as ua,c as s,d as n,m as g,a as h,x as R,h as o,b as c,N as oa,G as a,g as l,y as V,L as ma,q as W,o as Y,B as U,v as da}from"../../chunks/vendor-hf-doc-builder.js";import{I as Pn}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as la}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as fa}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function ba(Gn){let v,mt,w,j,Q,x,Ot,Z,Bt,dt,I,ft,M,Jt,bt,_,E,tt,S,Ft,nt,Kt,yt,q,Xt,at,zt,Rt,vt,D,Vt,wt,b,C,Wt,et,Yt,Ut,Qt,P,Zt,st,tn,nn,an,G,en,it,sn,rn,_t,O,hn,kt,N,jt,d,Nn,Et,B,on,qt,k,$,rt,A,ln,ht,cn,$t,J,pn,xt,L,It,F,gn,St,f,An,Ct,u,un,ot,mn,dn,lt,fn,bn,ct,yn,vn,H,wn,_n,pt,kn,jn,T,En,qn,Pt,y,$n,gt,xn,In,ut,Sn,Cn,Gt;return x=new Pn({}),I=new fa({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/vi/chapter9/section6.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/vi/chapter9/section6.ipynb"}]}}),S=new Pn({}),N=new la({props:{code:`import random

import gradio as gr


def chat(message, history):
    history = history or []
    if message.startswith("How many"):
        response = random.randint(1, 10)
    elif message.startswith("How"):
        response = random.choice(["Great", "Good", "Okay", "Bad"])
    elif message.startswith("Where"):
        response = random.choice(["Here", "There", "Somewhere"])
    else:
        response = "I don't know"
    history.append((message, response))
    return history, history


iface = gr.Interface(
    chat,
    ["text", "state"],
    ["chatbot", "state"],
    allow_screenshot=False,
    allow_flagging="never",
)
iface.launch()`,highlighted:`<span class="hljs-keyword">import</span> random

<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_">chat</span>(<span class="hljs-params">message, history</span>):
    history = history <span class="hljs-keyword">or</span> []
    <span class="hljs-keyword">if</span> message.startswith(<span class="hljs-string">&quot;How many&quot;</span>):
        response = random.randint(<span class="hljs-number">1</span>, <span class="hljs-number">10</span>)
    <span class="hljs-keyword">elif</span> message.startswith(<span class="hljs-string">&quot;How&quot;</span>):
        response = random.choice([<span class="hljs-string">&quot;Great&quot;</span>, <span class="hljs-string">&quot;Good&quot;</span>, <span class="hljs-string">&quot;Okay&quot;</span>, <span class="hljs-string">&quot;Bad&quot;</span>])
    <span class="hljs-keyword">elif</span> message.startswith(<span class="hljs-string">&quot;Where&quot;</span>):
        response = random.choice([<span class="hljs-string">&quot;Here&quot;</span>, <span class="hljs-string">&quot;There&quot;</span>, <span class="hljs-string">&quot;Somewhere&quot;</span>])
    <span class="hljs-keyword">else</span>:
        response = <span class="hljs-string">&quot;I don&#x27;t know&quot;</span>
    history.append((message, response))
    <span class="hljs-keyword">return</span> history, history


iface = gr.Interface(
    chat,
    [<span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;state&quot;</span>],
    [<span class="hljs-string">&quot;chatbot&quot;</span>, <span class="hljs-string">&quot;state&quot;</span>],
    allow_screenshot=<span class="hljs-literal">False</span>,
    allow_flagging=<span class="hljs-string">&quot;never&quot;</span>,
)
iface.launch()`}}),A=new Pn({}),L=new la({props:{code:`import requests
import tensorflow as tf

import gradio as gr

inception_net = tf.keras.applications.MobileNetV2()  # t\u1EA3i m\xF4 h\xECnh

# T\u1EA3i nh\xE3n con ng\u01B0\u1EDDi \u0111\u1ECDc \u0111\u01B0\u1EE3c cho ImageNet.
response = requests.get("https://git.io/JJkYN")
labels = response.text.split("\\n")


def classify_image(inp):
    inp = inp.reshape((-1, 224, 224, 3))
    inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp)
    prediction = inception_net.predict(inp).flatten()
    return {labels[i]: float(prediction[i]) for i in range(1000)}


image = gr.Image(shape=(224, 224))
label = gr.Label(num_top_classes=3)

title = "Gradio Image Classifiction + Interpretation Example"
gr.Interface(
    fn=classify_image, inputs=image, outputs=label, interpretation="default", title=title
).launch()`,highlighted:`<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr

inception_net = tf.keras.applications.MobileNetV2()  <span class="hljs-comment"># t\u1EA3i m\xF4 h\xECnh</span>

<span class="hljs-comment"># T\u1EA3i nh\xE3n con ng\u01B0\u1EDDi \u0111\u1ECDc \u0111\u01B0\u1EE3c cho ImageNet.</span>
response = requests.get(<span class="hljs-string">&quot;https://git.io/JJkYN&quot;</span>)
labels = response.text.split(<span class="hljs-string">&quot;\\n&quot;</span>)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">classify_image</span>(<span class="hljs-params">inp</span>):
    inp = inp.reshape((-<span class="hljs-number">1</span>, <span class="hljs-number">224</span>, <span class="hljs-number">224</span>, <span class="hljs-number">3</span>))
    inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp)
    prediction = inception_net.predict(inp).flatten()
    <span class="hljs-keyword">return</span> {labels[i]: <span class="hljs-built_in">float</span>(prediction[i]) <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">1000</span>)}


image = gr.Image(shape=(<span class="hljs-number">224</span>, <span class="hljs-number">224</span>))
label = gr.Label(num_top_classes=<span class="hljs-number">3</span>)

title = <span class="hljs-string">&quot;Gradio Image Classifiction + Interpretation Example&quot;</span>
gr.Interface(
    fn=classify_image, inputs=image, outputs=label, interpretation=<span class="hljs-string">&quot;default&quot;</span>, title=title
).launch()`}}),{c(){v=e("meta"),mt=p(),w=e("h1"),j=e("a"),Q=e("span"),z(x.$$.fragment),Ot=p(),Z=e("span"),Bt=r("C\xE1c t\xEDnh n\u0103ng n\xE2ng cao c\u1EE7a Interface"),dt=p(),z(I.$$.fragment),ft=p(),M=e("p"),Jt=r("B\xE2y gi\u1EDD ch\xFAng ta c\xF3 th\u1EC3 x\xE2y d\u1EF1ng v\xE0 chia s\u1EBB giao di\u1EC7n c\u01A1 b\u1EA3n, h\xE3y c\xF9ng kh\xE1m ph\xE1 m\u1ED9t s\u1ED1 t\xEDnh n\u0103ng n\xE2ng cao h\u01A1n nh\u01B0 tr\u1EA1ng th\xE1i v\xE0 di\u1EC5n gi\u1EA3i."),bt=p(),_=e("h3"),E=e("a"),tt=e("span"),z(S.$$.fragment),Ft=p(),nt=e("span"),Kt=r("S\u1EED d\u1EE5ng tr\u1EA1ng th\xE1i \u0111\u1EC3 duy tr\xEC d\u1EEF li\u1EC7u"),yt=p(),q=e("p"),Xt=r("Gradio h\u1ED7 tr\u1EE3 "),at=e("em"),zt=r("tr\u1EA1ng th\xE1i phi\xEAn"),Rt=r(", n\u01A1i d\u1EEF li\u1EC7u t\u1ED3n t\u1EA1i qua nhi\u1EC1u l\u1EA7n g\u1EEDi trong m\u1ED9t t\u1EA3i trang. Tr\u1EA1ng th\xE1i phi\xEAn h\u1EEFu \xEDch khi x\xE2y d\u1EF1ng c\xE1c b\u1EA3n demo, ch\u1EB3ng h\u1EA1n nh\u01B0 chatbot \u1EDF n\u01A1i b\u1EA1n mu\u1ED1n gi\u1EEF nguy\xEAn d\u1EEF li\u1EC7u khi ng\u01B0\u1EDDi d\xF9ng t\u01B0\u01A1ng t\xE1c v\u1EDBi m\xF4 h\xECnh. L\u01B0u \xFD r\u1EB1ng tr\u1EA1ng th\xE1i phi\xEAn kh\xF4ng chia s\u1EBB d\u1EEF li\u1EC7u gi\u1EEFa nh\u1EEFng ng\u01B0\u1EDDi d\xF9ng kh\xE1c nhau trong m\xF4 h\xECnh c\u1EE7a b\u1EA1n."),vt=p(),D=e("p"),Vt=r("\u0110\u1EC3 l\u01B0u tr\u1EEF d\u1EEF li\u1EC7u \u1EDF tr\u1EA1ng th\xE1i phi\xEAn, b\u1EA1n c\u1EA7n th\u1EF1c hi\u1EC7n ba vi\u1EC7c:"),wt=p(),b=e("ol"),C=e("li"),Wt=r("Truy\u1EC1n m\u1ED9t "),et=e("em"),Yt=r("tham s\u1ED1 b\u1ED5 sung"),Ut=r(" v\xE0o h\xE0m c\u1EE7a b\u1EA1n, n\xF3 th\u1EC3 hi\u1EC7n tr\u1EA1ng th\xE1i c\u1EE7a giao di\u1EC7n."),Qt=p(),P=e("li"),Zt=r("Khi k\u1EBFt th\xFAc h\xE0m, tr\u1EA3 v\u1EC1 gi\xE1 tr\u1ECB \u0111\xE3 c\u1EADp nh\u1EADt c\u1EE7a tr\u1EA1ng th\xE1i d\u01B0\u1EDBi d\u1EA1ng "),st=e("em"),tn=r("gi\xE1 tr\u1ECB tr\u1EA3 v\u1EC1 b\u1ED5 sung"),nn=r("."),an=p(),G=e("li"),en=r("Th\xEAm th\xE0nh ph\u1EA7n \u0111\u1EA7u v\xE0o \u2018state\u2019 v\xE0 \u0111\u1EA7u ra \u2018state\u2019 khi t\u1EA1o "),it=e("code"),sn=r("Interface"),rn=r(" c\u1EE7a b\u1EA1n."),_t=p(),O=e("p"),hn=r("Xem v\xED d\u1EE5 v\u1EC1 chatbot b\xEAn d\u01B0\u1EDBi:"),kt=p(),z(N.$$.fragment),jt=p(),d=e("iframe"),Et=p(),B=e("p"),on=r(`L\u01B0u \xFD tr\u1EA1ng th\xE1i c\u1EE7a th\xE0nh ph\u1EA7n \u0111\u1EA7u ra v\u1EABn t\u1ED3n t\u1EA1i qua c\xE1c l\u1EA7n g\u1EEDi.
L\u01B0u \xFD: b\u1EA1n c\xF3 th\u1EC3 chuy\u1EC3n gi\xE1 tr\u1ECB m\u1EB7c \u0111\u1ECBnh v\xE0o tham s\u1ED1 tr\u1EA1ng th\xE1i, \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng l\xE0m gi\xE1 tr\u1ECB ban \u0111\u1EA7u c\u1EE7a tr\u1EA1ng th\xE1i.`),qt=p(),k=e("h3"),$=e("a"),rt=e("span"),z(A.$$.fragment),ln=p(),ht=e("span"),cn=r("S\u1EED d\u1EE5ng di\u1EC5n gi\u1EA3i \u0111\u1EC3 hi\u1EC3u c\xE1c d\u1EF1 \u0111o\xE1n"),$t=p(),J=e("p"),pn=r("H\u1EA7u h\u1EBFt c\xE1c m\xF4 h\xECnh h\u1ECDc m\xE1y l\xE0 h\u1ED9p \u0111en v\xE0 logic b\xEAn trong c\u1EE7a h\xE0m b\u1ECB \u1EA9n kh\u1ECFi ng\u01B0\u1EDDi d\xF9ng cu\u1ED1i. \u0110\u1EC3 khuy\u1EBFn kh\xEDch t\xEDnh minh b\u1EA1ch, ch\xFAng t\xF4i \u0111\xE3 gi\xFAp b\u1EA1n d\u1EC5 d\xE0ng th\xEAm th\xF4ng d\u1ECBch v\xE0o m\xF4 h\xECnh c\u1EE7a m\xECnh b\u1EB1ng c\xE1ch ch\u1EC9 c\u1EA7n \u0111\u1EB7t t\u1EEB kh\xF3a th\xF4ng d\u1ECBch trong l\u1EDBp Interface th\xE0nh m\u1EB7c \u0111\u1ECBnh. \u0110i\u1EC1u n\xE0y cho ph\xE9p ng\u01B0\u1EDDi d\xF9ng c\u1EE7a b\u1EA1n hi\u1EC3u nh\u1EEFng ph\u1EA7n n\xE0o c\u1EE7a \u0111\u1EA7u v\xE0o ch\u1ECBu tr\xE1ch nhi\u1EC7m cho \u0111\u1EA7u ra. H\xE3y xem giao di\u1EC7n \u0111\u01A1n gi\u1EA3n b\xEAn d\u01B0\u1EDBi hi\u1EC3n th\u1ECB b\u1ED9 ph\xE2n lo\u1EA1i h\xECnh \u1EA3nh \u0111\u1ED3ng th\u1EDDi bao g\u1ED3m ph\u1EA7n di\u1EC5n gi\u1EA3i:"),xt=p(),z(L.$$.fragment),It=p(),F=e("p"),gn=r("Ki\u1EC3m tra h\xE0m th\xF4ng d\u1ECBch b\u1EB1ng c\xE1ch g\u1EEDi \u0111\u1EA7u v\xE0o, sau \u0111\xF3 nh\u1EA5p v\xE0o Interpret t\u01B0\u01A1ng \u1EE9ng di\u1EC5n gi\u1EA3i b\xEAn d\u01B0\u1EDBi th\xE0nh ph\u1EA7n \u0111\u1EA7u ra."),St=p(),f=e("iframe"),Ct=p(),u=e("p"),un=r("B\xEAn c\u1EA1nh ph\u01B0\u01A1ng ph\xE1p di\u1EC5n gi\u1EA3i m\u1EB7c \u0111\u1ECBnh m\xE0 Gradio cung c\u1EA5p, b\u1EA1n c\u0169ng c\xF3 th\u1EC3 ch\u1EC9 \u0111\u1ECBnh "),ot=e("code"),mn=r("shap"),dn=r(" cho tham s\u1ED1 "),lt=e("code"),fn=r("interpretation"),bn=r(" v\xE0 \u0111\u1EB7t tham s\u1ED1 "),ct=e("code"),yn=r("num_shap"),vn=r(". \u0110i\u1EC1u n\xE0y s\u1EED d\u1EE5ng di\u1EC5n gi\u1EA3i d\u1EF1a tr\xEAn Shapley, b\u1EA1n c\xF3 th\u1EC3 \u0111\u1ECDc th\xEAm v\u1EC1 "),H=e("a"),wn=r("t\u1EA1i \u0111\xE2y"),_n=r(`.
Cu\u1ED1i c\xF9ng, b\u1EA1n c\u0169ng c\xF3 th\u1EC3 chuy\u1EC3n h\xE0m th\xF4ng d\u1ECBch c\u1EE7a ri\xEAng m\xECnh v\xE0o tham s\u1ED1 `),pt=e("code"),kn=r("interpretation"),jn=r(". Xem v\xED d\u1EE5 trong trang b\u1EAFt \u0111\u1EA7u c\u1EE7a Gradio "),T=e("a"),En=r("t\u1EA1i \u0111\xE2y"),qn=r("."),Pt=p(),y=e("p"),$n=r("\u0110i\u1EC1u n\xE0y k\u1EBFt th\xFAc vi\u1EC7c \u0111i s\xE2u v\xE0o l\u1EDBp "),gt=e("code"),xn=r("Interface"),In=r(" c\u1EE7a Gradio. Nh\u01B0 ch\xFAng ta \u0111\xE3 th\u1EA5y, l\u1EDBp n\xE0y gi\xFAp vi\u1EC7c t\u1EA1o tr\xECnh di\u1EC5n h\u1ECDc m\xE1y tr\u1EDF n\xEAn \u0111\u01A1n gi\u1EA3n trong m\u1ED9t v\xE0i d\xF2ng m\xE3 Python. Tuy nhi\xEAn, \u0111\xF4i khi b\u1EA1n s\u1EBD mu\u1ED1n t\xF9y ch\u1EC9nh b\u1EA3n demo c\u1EE7a m\xECnh b\u1EB1ng c\xE1ch thay \u0111\u1ED5i b\u1ED1 c\u1EE5c ho\u1EB7c x\xE2u chu\u1ED7i nhi\u1EC1u h\xE0m d\u1EF1 \u0111o\xE1n l\u1EA1i v\u1EDBi nhau. S\u1EBD th\u1EADt tuy\u1EC7t n\u1EBFu b\u1EB1ng c\xE1ch n\xE0o \u0111\xF3 ch\xFAng ta c\xF3 th\u1EC3 chia "),ut=e("code"),Sn=r("Interface"),Cn=r(" th\xE0nh c\xE1c \u201Ckh\u1ED1i\u201D c\xF3 th\u1EC3 t\xF9y ch\u1EC9nh? May m\u1EAFn thay, c\xF3! \u0110\xF3 l\xE0 ch\u1EE7 \u0111\u1EC1 c\u1EE7a ph\u1EA7n cu\u1ED1i c\xF9ng."),this.h()},l(t){const i=ua('[data-svelte="svelte-1phssyn"]',document.head);v=s(i,"META",{name:!0,content:!0}),i.forEach(n),mt=g(t),w=s(t,"H1",{class:!0});var Nt=h(w);j=s(Nt,"A",{id:!0,class:!0,href:!0});var Ln=h(j);Q=s(Ln,"SPAN",{});var Hn=h(Q);R(x.$$.fragment,Hn),Hn.forEach(n),Ln.forEach(n),Ot=g(Nt),Z=s(Nt,"SPAN",{});var Tn=h(Z);Bt=o(Tn,"C\xE1c t\xEDnh n\u0103ng n\xE2ng cao c\u1EE7a Interface"),Tn.forEach(n),Nt.forEach(n),dt=g(t),R(I.$$.fragment,t),ft=g(t),M=s(t,"P",{});var Mn=h(M);Jt=o(Mn,"B\xE2y gi\u1EDD ch\xFAng ta c\xF3 th\u1EC3 x\xE2y d\u1EF1ng v\xE0 chia s\u1EBB giao di\u1EC7n c\u01A1 b\u1EA3n, h\xE3y c\xF9ng kh\xE1m ph\xE1 m\u1ED9t s\u1ED1 t\xEDnh n\u0103ng n\xE2ng cao h\u01A1n nh\u01B0 tr\u1EA1ng th\xE1i v\xE0 di\u1EC5n gi\u1EA3i."),Mn.forEach(n),bt=g(t),_=s(t,"H3",{class:!0});var At=h(_);E=s(At,"A",{id:!0,class:!0,href:!0});var Dn=h(E);tt=s(Dn,"SPAN",{});var On=h(tt);R(S.$$.fragment,On),On.forEach(n),Dn.forEach(n),Ft=g(At),nt=s(At,"SPAN",{});var Bn=h(nt);Kt=o(Bn,"S\u1EED d\u1EE5ng tr\u1EA1ng th\xE1i \u0111\u1EC3 duy tr\xEC d\u1EEF li\u1EC7u"),Bn.forEach(n),At.forEach(n),yt=g(t),q=s(t,"P",{});var Lt=h(q);Xt=o(Lt,"Gradio h\u1ED7 tr\u1EE3 "),at=s(Lt,"EM",{});var Jn=h(at);zt=o(Jn,"tr\u1EA1ng th\xE1i phi\xEAn"),Jn.forEach(n),Rt=o(Lt,", n\u01A1i d\u1EEF li\u1EC7u t\u1ED3n t\u1EA1i qua nhi\u1EC1u l\u1EA7n g\u1EEDi trong m\u1ED9t t\u1EA3i trang. Tr\u1EA1ng th\xE1i phi\xEAn h\u1EEFu \xEDch khi x\xE2y d\u1EF1ng c\xE1c b\u1EA3n demo, ch\u1EB3ng h\u1EA1n nh\u01B0 chatbot \u1EDF n\u01A1i b\u1EA1n mu\u1ED1n gi\u1EEF nguy\xEAn d\u1EEF li\u1EC7u khi ng\u01B0\u1EDDi d\xF9ng t\u01B0\u01A1ng t\xE1c v\u1EDBi m\xF4 h\xECnh. L\u01B0u \xFD r\u1EB1ng tr\u1EA1ng th\xE1i phi\xEAn kh\xF4ng chia s\u1EBB d\u1EEF li\u1EC7u gi\u1EEFa nh\u1EEFng ng\u01B0\u1EDDi d\xF9ng kh\xE1c nhau trong m\xF4 h\xECnh c\u1EE7a b\u1EA1n."),Lt.forEach(n),vt=g(t),D=s(t,"P",{});var Fn=h(D);Vt=o(Fn,"\u0110\u1EC3 l\u01B0u tr\u1EEF d\u1EEF li\u1EC7u \u1EDF tr\u1EA1ng th\xE1i phi\xEAn, b\u1EA1n c\u1EA7n th\u1EF1c hi\u1EC7n ba vi\u1EC7c:"),Fn.forEach(n),wt=g(t),b=s(t,"OL",{});var K=h(b);C=s(K,"LI",{});var Ht=h(C);Wt=o(Ht,"Truy\u1EC1n m\u1ED9t "),et=s(Ht,"EM",{});var Kn=h(et);Yt=o(Kn,"tham s\u1ED1 b\u1ED5 sung"),Kn.forEach(n),Ut=o(Ht," v\xE0o h\xE0m c\u1EE7a b\u1EA1n, n\xF3 th\u1EC3 hi\u1EC7n tr\u1EA1ng th\xE1i c\u1EE7a giao di\u1EC7n."),Ht.forEach(n),Qt=g(K),P=s(K,"LI",{});var Tt=h(P);Zt=o(Tt,"Khi k\u1EBFt th\xFAc h\xE0m, tr\u1EA3 v\u1EC1 gi\xE1 tr\u1ECB \u0111\xE3 c\u1EADp nh\u1EADt c\u1EE7a tr\u1EA1ng th\xE1i d\u01B0\u1EDBi d\u1EA1ng "),st=s(Tt,"EM",{});var Xn=h(st);tn=o(Xn,"gi\xE1 tr\u1ECB tr\u1EA3 v\u1EC1 b\u1ED5 sung"),Xn.forEach(n),nn=o(Tt,"."),Tt.forEach(n),an=g(K),G=s(K,"LI",{});var Mt=h(G);en=o(Mt,"Th\xEAm th\xE0nh ph\u1EA7n \u0111\u1EA7u v\xE0o \u2018state\u2019 v\xE0 \u0111\u1EA7u ra \u2018state\u2019 khi t\u1EA1o "),it=s(Mt,"CODE",{});var zn=h(it);sn=o(zn,"Interface"),zn.forEach(n),rn=o(Mt," c\u1EE7a b\u1EA1n."),Mt.forEach(n),K.forEach(n),_t=g(t),O=s(t,"P",{});var Rn=h(O);hn=o(Rn,"Xem v\xED d\u1EE5 v\u1EC1 chatbot b\xEAn d\u01B0\u1EDBi:"),Rn.forEach(n),kt=g(t),R(N.$$.fragment,t),jt=g(t),d=s(t,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),h(d).forEach(n),Et=g(t),B=s(t,"P",{});var Vn=h(B);on=o(Vn,`L\u01B0u \xFD tr\u1EA1ng th\xE1i c\u1EE7a th\xE0nh ph\u1EA7n \u0111\u1EA7u ra v\u1EABn t\u1ED3n t\u1EA1i qua c\xE1c l\u1EA7n g\u1EEDi.
L\u01B0u \xFD: b\u1EA1n c\xF3 th\u1EC3 chuy\u1EC3n gi\xE1 tr\u1ECB m\u1EB7c \u0111\u1ECBnh v\xE0o tham s\u1ED1 tr\u1EA1ng th\xE1i, \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng l\xE0m gi\xE1 tr\u1ECB ban \u0111\u1EA7u c\u1EE7a tr\u1EA1ng th\xE1i.`),Vn.forEach(n),qt=g(t),k=s(t,"H3",{class:!0});var Dt=h(k);$=s(Dt,"A",{id:!0,class:!0,href:!0});var Wn=h($);rt=s(Wn,"SPAN",{});var Yn=h(rt);R(A.$$.fragment,Yn),Yn.forEach(n),Wn.forEach(n),ln=g(Dt),ht=s(Dt,"SPAN",{});var Un=h(ht);cn=o(Un,"S\u1EED d\u1EE5ng di\u1EC5n gi\u1EA3i \u0111\u1EC3 hi\u1EC3u c\xE1c d\u1EF1 \u0111o\xE1n"),Un.forEach(n),Dt.forEach(n),$t=g(t),J=s(t,"P",{});var Qn=h(J);pn=o(Qn,"H\u1EA7u h\u1EBFt c\xE1c m\xF4 h\xECnh h\u1ECDc m\xE1y l\xE0 h\u1ED9p \u0111en v\xE0 logic b\xEAn trong c\u1EE7a h\xE0m b\u1ECB \u1EA9n kh\u1ECFi ng\u01B0\u1EDDi d\xF9ng cu\u1ED1i. \u0110\u1EC3 khuy\u1EBFn kh\xEDch t\xEDnh minh b\u1EA1ch, ch\xFAng t\xF4i \u0111\xE3 gi\xFAp b\u1EA1n d\u1EC5 d\xE0ng th\xEAm th\xF4ng d\u1ECBch v\xE0o m\xF4 h\xECnh c\u1EE7a m\xECnh b\u1EB1ng c\xE1ch ch\u1EC9 c\u1EA7n \u0111\u1EB7t t\u1EEB kh\xF3a th\xF4ng d\u1ECBch trong l\u1EDBp Interface th\xE0nh m\u1EB7c \u0111\u1ECBnh. \u0110i\u1EC1u n\xE0y cho ph\xE9p ng\u01B0\u1EDDi d\xF9ng c\u1EE7a b\u1EA1n hi\u1EC3u nh\u1EEFng ph\u1EA7n n\xE0o c\u1EE7a \u0111\u1EA7u v\xE0o ch\u1ECBu tr\xE1ch nhi\u1EC7m cho \u0111\u1EA7u ra. H\xE3y xem giao di\u1EC7n \u0111\u01A1n gi\u1EA3n b\xEAn d\u01B0\u1EDBi hi\u1EC3n th\u1ECB b\u1ED9 ph\xE2n lo\u1EA1i h\xECnh \u1EA3nh \u0111\u1ED3ng th\u1EDDi bao g\u1ED3m ph\u1EA7n di\u1EC5n gi\u1EA3i:"),Qn.forEach(n),xt=g(t),R(L.$$.fragment,t),It=g(t),F=s(t,"P",{});var Zn=h(F);gn=o(Zn,"Ki\u1EC3m tra h\xE0m th\xF4ng d\u1ECBch b\u1EB1ng c\xE1ch g\u1EEDi \u0111\u1EA7u v\xE0o, sau \u0111\xF3 nh\u1EA5p v\xE0o Interpret t\u01B0\u01A1ng \u1EE9ng di\u1EC5n gi\u1EA3i b\xEAn d\u01B0\u1EDBi th\xE0nh ph\u1EA7n \u0111\u1EA7u ra."),Zn.forEach(n),St=g(t),f=s(t,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),h(f).forEach(n),Ct=g(t),u=s(t,"P",{});var m=h(u);un=o(m,"B\xEAn c\u1EA1nh ph\u01B0\u01A1ng ph\xE1p di\u1EC5n gi\u1EA3i m\u1EB7c \u0111\u1ECBnh m\xE0 Gradio cung c\u1EA5p, b\u1EA1n c\u0169ng c\xF3 th\u1EC3 ch\u1EC9 \u0111\u1ECBnh "),ot=s(m,"CODE",{});var ta=h(ot);mn=o(ta,"shap"),ta.forEach(n),dn=o(m," cho tham s\u1ED1 "),lt=s(m,"CODE",{});var na=h(lt);fn=o(na,"interpretation"),na.forEach(n),bn=o(m," v\xE0 \u0111\u1EB7t tham s\u1ED1 "),ct=s(m,"CODE",{});var aa=h(ct);yn=o(aa,"num_shap"),aa.forEach(n),vn=o(m,". \u0110i\u1EC1u n\xE0y s\u1EED d\u1EE5ng di\u1EC5n gi\u1EA3i d\u1EF1a tr\xEAn Shapley, b\u1EA1n c\xF3 th\u1EC3 \u0111\u1ECDc th\xEAm v\u1EC1 "),H=s(m,"A",{href:!0,rel:!0});var ea=h(H);wn=o(ea,"t\u1EA1i \u0111\xE2y"),ea.forEach(n),_n=o(m,`.
Cu\u1ED1i c\xF9ng, b\u1EA1n c\u0169ng c\xF3 th\u1EC3 chuy\u1EC3n h\xE0m th\xF4ng d\u1ECBch c\u1EE7a ri\xEAng m\xECnh v\xE0o tham s\u1ED1 `),pt=s(m,"CODE",{});var sa=h(pt);kn=o(sa,"interpretation"),sa.forEach(n),jn=o(m,". Xem v\xED d\u1EE5 trong trang b\u1EAFt \u0111\u1EA7u c\u1EE7a Gradio "),T=s(m,"A",{href:!0,rel:!0});var ia=h(T);En=o(ia,"t\u1EA1i \u0111\xE2y"),ia.forEach(n),qn=o(m,"."),m.forEach(n),Pt=g(t),y=s(t,"P",{});var X=h(y);$n=o(X,"\u0110i\u1EC1u n\xE0y k\u1EBFt th\xFAc vi\u1EC7c \u0111i s\xE2u v\xE0o l\u1EDBp "),gt=s(X,"CODE",{});var ra=h(gt);xn=o(ra,"Interface"),ra.forEach(n),In=o(X," c\u1EE7a Gradio. Nh\u01B0 ch\xFAng ta \u0111\xE3 th\u1EA5y, l\u1EDBp n\xE0y gi\xFAp vi\u1EC7c t\u1EA1o tr\xECnh di\u1EC5n h\u1ECDc m\xE1y tr\u1EDF n\xEAn \u0111\u01A1n gi\u1EA3n trong m\u1ED9t v\xE0i d\xF2ng m\xE3 Python. Tuy nhi\xEAn, \u0111\xF4i khi b\u1EA1n s\u1EBD mu\u1ED1n t\xF9y ch\u1EC9nh b\u1EA3n demo c\u1EE7a m\xECnh b\u1EB1ng c\xE1ch thay \u0111\u1ED5i b\u1ED1 c\u1EE5c ho\u1EB7c x\xE2u chu\u1ED7i nhi\u1EC1u h\xE0m d\u1EF1 \u0111o\xE1n l\u1EA1i v\u1EDBi nhau. S\u1EBD th\u1EADt tuy\u1EC7t n\u1EBFu b\u1EB1ng c\xE1ch n\xE0o \u0111\xF3 ch\xFAng ta c\xF3 th\u1EC3 chia "),ut=s(X,"CODE",{});var ha=h(ut);Sn=o(ha,"Interface"),ha.forEach(n),Cn=o(X," th\xE0nh c\xE1c \u201Ckh\u1ED1i\u201D c\xF3 th\u1EC3 t\xF9y ch\u1EC9nh? May m\u1EAFn thay, c\xF3! \u0110\xF3 l\xE0 ch\u1EE7 \u0111\u1EC1 c\u1EE7a ph\u1EA7n cu\u1ED1i c\xF9ng."),X.forEach(n),this.h()},h(){c(v,"name","hf:doc:metadata"),c(v,"content",JSON.stringify(ya)),c(j,"id","cc-tnh-nng-nng-cao-ca-interface"),c(j,"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"),c(j,"href","#cc-tnh-nng-nng-cao-ca-interface"),c(w,"class","relative group"),c(E,"id","s-dng-trng-thi-duy-tr-d-liu"),c(E,"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"),c(E,"href","#s-dng-trng-thi-duy-tr-d-liu"),c(_,"class","relative group"),oa(d.src,Nn="https://course-demos-Chatbot-Demo.hf.space")||c(d,"src",Nn),c(d,"frameborder","0"),c(d,"height","350"),c(d,"title","Gradio app"),c(d,"class","container p-0 flex-grow space-iframe"),c(d,"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(d,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),c($,"id","s-dng-din-gii-hiu-cc-d-on"),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"),c($,"href","#s-dng-din-gii-hiu-cc-d-on"),c(k,"class","relative group"),oa(f.src,An="https://course-demos-gradio-image-interpretation.hf.space")||c(f,"src",An),c(f,"frameborder","0"),c(f,"height","570"),c(f,"title","Gradio app"),c(f,"class","container p-0 flex-grow space-iframe"),c(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"),c(f,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),c(H,"href","https://christophm.github.io/interpretable-ml-book/shap.html"),c(H,"rel","nofollow"),c(T,"href","https://gradio.app/getting_started/"),c(T,"rel","nofollow")},m(t,i){a(document.head,v),l(t,mt,i),l(t,w,i),a(w,j),a(j,Q),V(x,Q,null),a(w,Ot),a(w,Z),a(Z,Bt),l(t,dt,i),V(I,t,i),l(t,ft,i),l(t,M,i),a(M,Jt),l(t,bt,i),l(t,_,i),a(_,E),a(E,tt),V(S,tt,null),a(_,Ft),a(_,nt),a(nt,Kt),l(t,yt,i),l(t,q,i),a(q,Xt),a(q,at),a(at,zt),a(q,Rt),l(t,vt,i),l(t,D,i),a(D,Vt),l(t,wt,i),l(t,b,i),a(b,C),a(C,Wt),a(C,et),a(et,Yt),a(C,Ut),a(b,Qt),a(b,P),a(P,Zt),a(P,st),a(st,tn),a(P,nn),a(b,an),a(b,G),a(G,en),a(G,it),a(it,sn),a(G,rn),l(t,_t,i),l(t,O,i),a(O,hn),l(t,kt,i),V(N,t,i),l(t,jt,i),l(t,d,i),l(t,Et,i),l(t,B,i),a(B,on),l(t,qt,i),l(t,k,i),a(k,$),a($,rt),V(A,rt,null),a(k,ln),a(k,ht),a(ht,cn),l(t,$t,i),l(t,J,i),a(J,pn),l(t,xt,i),V(L,t,i),l(t,It,i),l(t,F,i),a(F,gn),l(t,St,i),l(t,f,i),l(t,Ct,i),l(t,u,i),a(u,un),a(u,ot),a(ot,mn),a(u,dn),a(u,lt),a(lt,fn),a(u,bn),a(u,ct),a(ct,yn),a(u,vn),a(u,H),a(H,wn),a(u,_n),a(u,pt),a(pt,kn),a(u,jn),a(u,T),a(T,En),a(u,qn),l(t,Pt,i),l(t,y,i),a(y,$n),a(y,gt),a(gt,xn),a(y,In),a(y,ut),a(ut,Sn),a(y,Cn),Gt=!0},p:ma,i(t){Gt||(W(x.$$.fragment,t),W(I.$$.fragment,t),W(S.$$.fragment,t),W(N.$$.fragment,t),W(A.$$.fragment,t),W(L.$$.fragment,t),Gt=!0)},o(t){Y(x.$$.fragment,t),Y(I.$$.fragment,t),Y(S.$$.fragment,t),Y(N.$$.fragment,t),Y(A.$$.fragment,t),Y(L.$$.fragment,t),Gt=!1},d(t){n(v),t&&n(mt),t&&n(w),U(x),t&&n(dt),U(I,t),t&&n(ft),t&&n(M),t&&n(bt),t&&n(_),U(S),t&&n(yt),t&&n(q),t&&n(vt),t&&n(D),t&&n(wt),t&&n(b),t&&n(_t),t&&n(O),t&&n(kt),U(N,t),t&&n(jt),t&&n(d),t&&n(Et),t&&n(B),t&&n(qt),t&&n(k),U(A),t&&n($t),t&&n(J),t&&n(xt),U(L,t),t&&n(It),t&&n(F),t&&n(St),t&&n(f),t&&n(Ct),t&&n(u),t&&n(Pt),t&&n(y)}}}const ya={local:"cc-tnh-nng-nng-cao-ca-interface",sections:[{local:"s-dng-trng-thi-duy-tr-d-liu",title:"S\u1EED d\u1EE5ng tr\u1EA1ng th\xE1i \u0111\u1EC3 duy tr\xEC d\u1EEF li\u1EC7u"},{local:"s-dng-din-gii-hiu-cc-d-on",title:"S\u1EED d\u1EE5ng di\u1EC5n gi\u1EA3i \u0111\u1EC3 hi\u1EC3u c\xE1c d\u1EF1 \u0111o\xE1n"}],title:"C\xE1c t\xEDnh n\u0103ng n\xE2ng cao c\u1EE7a Interface"};function va(Gn){return da(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ea extends ca{constructor(v){super();pa(this,v,va,ba,ga,{})}}export{Ea as default,ya as metadata};
