Buckets:

rtrm's picture
download
raw
13.5 kB
import{s as ke,n as Te,o as Ge}from"../chunks/scheduler.893fe8c9.js";import{S as ve,i as _e,e as he,s as n,c as i,h as He,a as $e,d as o,b as r,f as xe,g as s,j as qe,k as be,l as Fe,m as a,n as l,t as u,o as m,p}from"../chunks/index.b1df2166.js";import{C as Pe,H as d,E as We}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d3b872a1.js";import{C as Be}from"../chunks/CourseFloatingBanner.c1c08878.js";import{Q as f}from"../chunks/Question.ea6d4cb0.js";function Se(ye){let c,N,z,J,g,O,h,D,$,U,y,we="Let’s test what you learned in this chapter!",j,w,Q,x,R,b,K,k,V,T,X,G,Z,v,ee,_,te,H,oe,q,ae,F,ne,P,re,W,ie,B,se,S,le,A,ue,C,me,I,pe,E,de,L,fe,Y,ce,M,ge;return g=new Pe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),h=new d({props:{title:"End-of-chapter quiz",local:"end-of-chapter-quiz",headingTag:"h1"}}),$=new Be({props:{chapter:9,classNames:"absolute z-10 right-0 top-0"}}),w=new d({props:{title:"1. What can you use Gradio to do?",local:"1-what-can-you-use-gradio-to-do",headingTag:"h3"}}),x=new f({props:{choices:[{text:"Create a demo for your machine learning model",explain:"With a few lines of python code you can generate a demo for your ML model using our library of pre-built components.",correct:!0},{text:"Share your machine learning model with others",explain:"Using the <code>share=True</code> parameter in the launch method, you can generate a share link to send to anyone.",correct:!0},{text:"Debug your model",explain:"One advantage of a gradio demo is being able to test your model with real data which you can change and observe the model's predictions change in real time, helping you debug your model.",correct:!0},{text:"Train your model",explain:"Gradio is designed to be used for model inference, AFTER your model is trained."}]}}),b=new d({props:{title:"2. Gradio ONLY works with PyTorch models",local:"2-gradio-only-works-with-pytorch-models",headingTag:"h3"}}),k=new f({props:{choices:[{text:"True",explain:"Gradio works with PyTorch models, but also works for any type of machine learning model!"},{text:"False",explain:"Gradio is model agnostic, meaning you can create a demo for any type of machine learning model.",correct:!0}]}}),T=new d({props:{title:"3. Where can you launch a Gradio demo from?",local:"3-where-can-you-launch-a-gradio-demo-from",headingTag:"h3"}}),G=new f({props:{choices:[{text:"Standard python IDEs",explain:"Gradio works great with your favorite IDE.",correct:!0},{text:"Google Colab notebooks",explain:"You can create and launch a demo within your Google colab notebook.",correct:!0},{text:"Jupyter notebooks",explain:"Good choice - You can create and launch a demo within your Jupyter notebook.",correct:!0}]}}),v=new d({props:{title:"4. Gradio is designed primarily for NLP models",local:"4-gradio-is-designed-primarily-for-nlp-models",headingTag:"h3"}}),_=new f({props:{choices:[{text:"True",explain:"Gradio works with pretty much any data type, not just NLP."},{text:"False",explain:"Gradio supplies developers with a library of pre-built components for pretty much all data types.",correct:!0}]}}),H=new d({props:{title:"5. Which of the following features are supported by Gradio?",local:"5-which-of-the-following-features-are-supported-by-gradio",headingTag:"h3"}}),q=new f({props:{choices:[{text:"Multiple inputs and outputs",explain:"Multiple inputs and outputs is possible with gradio. All you need to do is pass in a list of inputs and outputs to their corresponding parameters",correct:!0},{text:"State for data persistance",explain:"Gradio is capable of adding state to your interface.",correct:!0},{text:"Username and passwords authentication",explain:"Pass in a list of username/password tuples to the launch method to add authentication.",correct:!0},{text:"Automatic analytics for who uses your gradio demo",explain:"Try again - Gradio does not supply developers analytics on who uses their demos."},{text:"Loading a model from Hugging Face's model hub or Hugging Face Spaces",explain:"Absolutely - load any Hugging Face model using the <code>gr.Interface.load()</code> method",correct:!0}]}}),F=new d({props:{title:"6. Which of the following are valid ways of loading a Hugging Face model from Hub or Spaces?",local:"6-which-of-the-following-are-valid-ways-of-loading-a-hugging-face-model-from-hub-or-spaces",headingTag:"h3"}}),P=new f({props:{choices:[{text:"gr.Interface.load('huggingface/{user}/{model_name}')",explain:"This is a valid method of loading a Hugging Face model from the Hub",correct:!0},{text:"gr.Interface.load('model/{user}/{model_name}')",explain:"This is a valid method of loading a Hugging Face model from the Hub",correct:!0},{text:"gr.Interface.load('demos/{user}/{model_name}')",explain:"Try again -- you cannot load a model by using the 'demos' prefix."},{text:"gr.Interface.load('spaces/{user}/{model_name}')",explain:"This is a valid method of loading a Hugging Face model from Spaces",correct:!0}]}}),W=new d({props:{title:"7. Select all the steps necessary for adding state to your Gradio interface",local:"7-select-all-the-steps-necessary-for-adding-state-to-your-gradio-interface",headingTag:"h3"}}),B=new f({props:{choices:[{text:"Pass in an extra parameter into your prediction function, which represents the state of the interface.",explain:"An extra parameter storing history or state of your interface is necessary.",correct:!0},{text:"At the end of the prediction function, return the updated value of the state as an extra return value.",explain:"This history or state value needs to be returned by your function.",correct:!0},{text:"Add the state input and state output components when creating your Interface",explain:"Gradio provides a state input and output component to persist data.",correct:!0}]}}),S=new d({props:{title:"8. Which of the following are components included in the Gradio library?",local:"8-which-of-the-following-are-components-included-in-the-gradio-library",headingTag:"h3"}}),A=new f({props:{choices:[{text:"Textbox.",explain:"Yes, you can create textboxes with the Textbox component.",correct:!0},{text:"Graph.",explain:"There is currently no Graph component."},{text:"Image.",explain:"Yes, you can create an image upload widget with the Image component.",correct:!0},{text:"Audio.",explain:"Yes, you can create an audio upload widget with the Audio component.",correct:!0}]}}),C=new d({props:{title:"9. What does Gradio Blocks allow you to do?",local:"9-what-does-gradio-blocks-allow-you-to-do",headingTag:"h3"}}),I=new f({props:{choices:[{text:"Combine multiple demos into one web app",explain:"You can use the `with gradio.Tabs():` to add tabs for multiple demos",correct:!0},{text:"Assign event triggers such as clicked/changed/etc to `Blocks` components",explain:"When you assign an event, you pass in three parameters: fn: the function that should be called, inputs: the (list) of input component(s), and outputs: the (list) of output components that should be called.",correct:!0},{text:"Automatically determine which `Blocks` component should be interactive vs. static",explain:"Based on the event triggers you define, `Blocks` automatically figures out whether a component should accept user input or not.",correct:!0},{text:"Create multi-step demos; meaning allowing you to reuse the output of one component as the input to the next",explain:"You can use a component for the input of one event trigger but the output of another.",correct:!0}]}}),E=new d({props:{title:"10. You can share a public link to a Blocks demo and host a Blocks demo on Hugging Face spaces.",local:"10-you-can-share-a-public-link-to-a-blocks-demo-and-host-a-blocks-demo-on-hugging-face-spaces",headingTag:"h3"}}),L=new f({props:{choices:[{text:"True",explain:"Just like `Interface`, all of the sharing and hosting capabilities are the same for `Blocks` demos!",correct:!0},{text:"False",explain:"Just like `Interface`, all of the sharing and hosting capabilities are the same for `Blocks` demos!",correct:!1}]}}),Y=new We({props:{source:"https://github.com/huggingface/course/blob/main/chapters/en/chapter9/9.mdx"}}),{c(){c=he("meta"),N=n(),z=he("p"),J=n(),i(g.$$.fragment),O=n(),i(h.$$.fragment),D=n(),i($.$$.fragment),U=n(),y=he("p"),y.textContent=we,j=n(),i(w.$$.fragment),Q=n(),i(x.$$.fragment),R=n(),i(b.$$.fragment),K=n(),i(k.$$.fragment),V=n(),i(T.$$.fragment),X=n(),i(G.$$.fragment),Z=n(),i(v.$$.fragment),ee=n(),i(_.$$.fragment),te=n(),i(H.$$.fragment),oe=n(),i(q.$$.fragment),ae=n(),i(F.$$.fragment),ne=n(),i(P.$$.fragment),re=n(),i(W.$$.fragment),ie=n(),i(B.$$.fragment),se=n(),i(S.$$.fragment),le=n(),i(A.$$.fragment),ue=n(),i(C.$$.fragment),me=n(),i(I.$$.fragment),pe=n(),i(E.$$.fragment),de=n(),i(L.$$.fragment),fe=n(),i(Y.$$.fragment),ce=n(),M=he("p"),this.h()},l(e){const t=He("svelte-u9bgzb",document.head);c=$e(t,"META",{name:!0,content:!0}),t.forEach(o),N=r(e),z=$e(e,"P",{}),xe(z).forEach(o),J=r(e),s(g.$$.fragment,e),O=r(e),s(h.$$.fragment,e),D=r(e),s($.$$.fragment,e),U=r(e),y=$e(e,"P",{"data-svelte-h":!0}),qe(y)!=="svelte-19og2hy"&&(y.textContent=we),j=r(e),s(w.$$.fragment,e),Q=r(e),s(x.$$.fragment,e),R=r(e),s(b.$$.fragment,e),K=r(e),s(k.$$.fragment,e),V=r(e),s(T.$$.fragment,e),X=r(e),s(G.$$.fragment,e),Z=r(e),s(v.$$.fragment,e),ee=r(e),s(_.$$.fragment,e),te=r(e),s(H.$$.fragment,e),oe=r(e),s(q.$$.fragment,e),ae=r(e),s(F.$$.fragment,e),ne=r(e),s(P.$$.fragment,e),re=r(e),s(W.$$.fragment,e),ie=r(e),s(B.$$.fragment,e),se=r(e),s(S.$$.fragment,e),le=r(e),s(A.$$.fragment,e),ue=r(e),s(C.$$.fragment,e),me=r(e),s(I.$$.fragment,e),pe=r(e),s(E.$$.fragment,e),de=r(e),s(L.$$.fragment,e),fe=r(e),s(Y.$$.fragment,e),ce=r(e),M=$e(e,"P",{}),xe(M).forEach(o),this.h()},h(){be(c,"name","hf:doc:metadata"),be(c,"content",Ae)},m(e,t){Fe(document.head,c),a(e,N,t),a(e,z,t),a(e,J,t),l(g,e,t),a(e,O,t),l(h,e,t),a(e,D,t),l($,e,t),a(e,U,t),a(e,y,t),a(e,j,t),l(w,e,t),a(e,Q,t),l(x,e,t),a(e,R,t),l(b,e,t),a(e,K,t),l(k,e,t),a(e,V,t),l(T,e,t),a(e,X,t),l(G,e,t),a(e,Z,t),l(v,e,t),a(e,ee,t),l(_,e,t),a(e,te,t),l(H,e,t),a(e,oe,t),l(q,e,t),a(e,ae,t),l(F,e,t),a(e,ne,t),l(P,e,t),a(e,re,t),l(W,e,t),a(e,ie,t),l(B,e,t),a(e,se,t),l(S,e,t),a(e,le,t),l(A,e,t),a(e,ue,t),l(C,e,t),a(e,me,t),l(I,e,t),a(e,pe,t),l(E,e,t),a(e,de,t),l(L,e,t),a(e,fe,t),l(Y,e,t),a(e,ce,t),a(e,M,t),ge=!0},p:Te,i(e){ge||(u(g.$$.fragment,e),u(h.$$.fragment,e),u($.$$.fragment,e),u(w.$$.fragment,e),u(x.$$.fragment,e),u(b.$$.fragment,e),u(k.$$.fragment,e),u(T.$$.fragment,e),u(G.$$.fragment,e),u(v.$$.fragment,e),u(_.$$.fragment,e),u(H.$$.fragment,e),u(q.$$.fragment,e),u(F.$$.fragment,e),u(P.$$.fragment,e),u(W.$$.fragment,e),u(B.$$.fragment,e),u(S.$$.fragment,e),u(A.$$.fragment,e),u(C.$$.fragment,e),u(I.$$.fragment,e),u(E.$$.fragment,e),u(L.$$.fragment,e),u(Y.$$.fragment,e),ge=!0)},o(e){m(g.$$.fragment,e),m(h.$$.fragment,e),m($.$$.fragment,e),m(w.$$.fragment,e),m(x.$$.fragment,e),m(b.$$.fragment,e),m(k.$$.fragment,e),m(T.$$.fragment,e),m(G.$$.fragment,e),m(v.$$.fragment,e),m(_.$$.fragment,e),m(H.$$.fragment,e),m(q.$$.fragment,e),m(F.$$.fragment,e),m(P.$$.fragment,e),m(W.$$.fragment,e),m(B.$$.fragment,e),m(S.$$.fragment,e),m(A.$$.fragment,e),m(C.$$.fragment,e),m(I.$$.fragment,e),m(E.$$.fragment,e),m(L.$$.fragment,e),m(Y.$$.fragment,e),ge=!1},d(e){e&&(o(N),o(z),o(J),o(O),o(D),o(U),o(y),o(j),o(Q),o(R),o(K),o(V),o(X),o(Z),o(ee),o(te),o(oe),o(ae),o(ne),o(re),o(ie),o(se),o(le),o(ue),o(me),o(pe),o(de),o(fe),o(ce),o(M)),o(c),p(g,e),p(h,e),p($,e),p(w,e),p(x,e),p(b,e),p(k,e),p(T,e),p(G,e),p(v,e),p(_,e),p(H,e),p(q,e),p(F,e),p(P,e),p(W,e),p(B,e),p(S,e),p(A,e),p(C,e),p(I,e),p(E,e),p(L,e),p(Y,e)}}}const Ae='{"title":"End-of-chapter quiz","local":"end-of-chapter-quiz","sections":[{"title":"1. What can you use Gradio to do?","local":"1-what-can-you-use-gradio-to-do","sections":[],"depth":3},{"title":"2. Gradio ONLY works with PyTorch models","local":"2-gradio-only-works-with-pytorch-models","sections":[],"depth":3},{"title":"3. Where can you launch a Gradio demo from?","local":"3-where-can-you-launch-a-gradio-demo-from","sections":[],"depth":3},{"title":"4. Gradio is designed primarily for NLP models","local":"4-gradio-is-designed-primarily-for-nlp-models","sections":[],"depth":3},{"title":"5. Which of the following features are supported by Gradio?","local":"5-which-of-the-following-features-are-supported-by-gradio","sections":[],"depth":3},{"title":"6. Which of the following are valid ways of loading a Hugging Face model from Hub or Spaces?","local":"6-which-of-the-following-are-valid-ways-of-loading-a-hugging-face-model-from-hub-or-spaces","sections":[],"depth":3},{"title":"7. Select all the steps necessary for adding state to your Gradio interface","local":"7-select-all-the-steps-necessary-for-adding-state-to-your-gradio-interface","sections":[],"depth":3},{"title":"8. Which of the following are components included in the Gradio library?","local":"8-which-of-the-following-are-components-included-in-the-gradio-library","sections":[],"depth":3},{"title":"9. What does Gradio Blocks allow you to do?","local":"9-what-does-gradio-blocks-allow-you-to-do","sections":[],"depth":3},{"title":"10. You can share a public link to a Blocks demo and host a Blocks demo on Hugging Face spaces.","local":"10-you-can-share-a-public-link-to-a-blocks-demo-and-host-a-blocks-demo-on-hugging-face-spaces","sections":[],"depth":3}],"depth":1}';function Ce(ye){return Ge(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Me extends ve{constructor(c){super(),_e(this,c,Ce,Se,ke,{})}}export{Me as component};

Xet Storage Details

Size:
13.5 kB
·
Xet hash:
d433a5432020461afc97675df173102ccd8783d51904fa425a7fa4d1853139ec

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.