Skip to content

Commit

Permalink
Bump release 10 (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
lewtun authored May 18, 2022
1 parent 679bdbf commit e6d0531
Show file tree
Hide file tree
Showing 8 changed files with 289 additions and 240 deletions.
5 changes: 3 additions & 2 deletions chapters/en/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@
title: End-of-chapter quiz
quiz: 8

- local: chapter9
title: 9. Building and sharing demos
- title: 9. Building and sharing demos
new: true
subtitle: I trained a model, but how can I show it off?
sections:
Expand All @@ -187,6 +186,8 @@
- local: chapter9/7
title: Introduction to Blocks
- local: chapter9/8
title: Gradio, check!
- local: chapter9/9
title: End-of-chapter quiz
quiz: 9

Expand Down
4 changes: 4 additions & 0 deletions chapters/en/chapter1/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ After you've completed this course, we recommend checking out DeepLearning.AI's

About the authors:

**Abubakar Abid** completed his PhD at Stanford in applied machine learning. During his PhD, he founded [Gradio](https://github.com/gradio-app/gradio), an open-source Python library that has been used to build over 600,000 machine learning demos. Gradio was acquired by Hugging Face, which is where Abubakar now serves as a machine learning team lead.

**Matthew Carrigan** is a Machine Learning Engineer at Hugging Face. He lives in Dublin, Ireland and previously worked as an ML engineer at Parse.ly and before that as a post-doctoral researcher at Trinity College Dublin. He does not believe we're going to get to AGI by scaling existing architectures, but has high hopes for robot immortality regardless.

**Lysandre Debut** is a Machine Learning Engineer at Hugging Face and has been working on the 🤗 Transformers library since the very early development stages. His aim is to make NLP accessible for everyone by developing tools with a very simple API.

**Sylvain Gugger** is a Research Engineer at Hugging Face and one of the core maintainers of the 🤗 Transformers library. Previously he was a Research Scientist at fast.ai, and he co-wrote _[Deep Learning for Coders with fastai and PyTorch](https://learning.oreilly.com/library/view/deep-learning-for/9781492045519/)_ with Jeremy Howard. The main focus of his research is on making deep learning more accessible, by designing and improving techniques that allow models to train fast on limited resources.

**Dawood Khan** is a Machine Learning Engineer at Hugging Face. He's from NYC and graduated from New York University studying Computer Science. After working as an iOS Engineer for a few years, Dawood quit to start Gradio with his fellow co-founders. Gradio was eventually acquired by Hugging Face.

**Merve Noyan** is a developer advocate at Hugging Face, working on developing tools and building content around them to democratize machine learning for everyone.

**Lucile Saulnier** is a machine learning engineer at Hugging Face, developing and supporting the use of open source tools. She is also actively involved in many research projects in the field of Natural Language Processing such as collaborative training and BigScience.
Expand Down
8 changes: 7 additions & 1 deletion chapters/en/chapter9/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Here are some examples of machine learning demos built with Gradio:

* An extractive **question answering** model that takes in a context paragraph and a quest and outputs a response and a probability score (we discussed this kind of model [in Chapter 7](/course/chapter7/7)):

<iframe src="https://hf.space/gradioiframe/course-demos/question-answering-simple/+" frameBorder="0" height="420" title="Gradio app" class="container p-0 flex-grow space-iframe" 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" sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"></iframe>
<iframe src="https://hf.space/gradioiframe/course-demos/question-answering-simple/+" frameBorder="0" height="640" title="Gradio app" class="container p-0 flex-grow space-iframe" 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" sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"></iframe>

* A **background removal** model that takes in an image and outputs the image with the background removed:

Expand All @@ -30,3 +30,9 @@ This chapter is broken down into sections which include both _concepts_ and _app
<Tip>
👀 Check out <a href="https://huggingface.co/spaces" target="_blank">Hugging Face Spaces</a> to see many recent examples of machine learning demos built by the machine learning community!
</Tip>

## Gradio blocks party 🥳

If you want to put the knowledge from this chapter to good use, come join the Gradio blocks party! This is a community event that's hosted by Hugging Face on **May 16-31**. During this event, you'll build cool machine learning demos with Gradio and be in the running to win Hugging Face swag and prizes!

Check out the [event description](https://github.com/AK391/community-events/blob/main/gradio-blocks/README.md) for details on how to participate - we can't wait to see what you'll build 🤗!
239 changes: 11 additions & 228 deletions chapters/en/chapter9/8.mdx
Original file line number Diff line number Diff line change
@@ -1,234 +1,17 @@
<!-- DISABLE-FRONTMATTER-SECTIONS -->
# Gradio, check!

# End-of-chapter quiz
This wraps up the chapter on building cool ML demos with Gradio - we hope you enjoyed it! To recap, in this chapter we learned:

Let's test what you learned in this chapter!
- How to create Gradio demos with the high-level `Interface` API, and how to configure different input and output modalities.
- Different ways to share Gradio demos, through temporary links and hosting on [Hugging Face Spaces](https://huggingface.co/spaces).
- How to integrate Gradio demos with models and Spaces on the Hugging Face Hub.
- Advanced features like storing state in a demo or providing authentication.
- How to have full control of the data flow and layout of your demo with Gradio Blocks.

### 1. What can you use Gradio to do?
If you'd like to test your understanding of the concepts covered in this chapter, check out the quiz in the next section!

<Question
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: true
},
{
text: "Share your machine learning model with others",
explain: "Using the share=True parameter in the launch method, you can generate a share link to send to anyone.",
correct: true
},
{
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: true
},
{
text: "Train your model",
explain: "Gradio is designed to be used for model inference, AFTER your model is trained.",
}
]}
/>
## Gradio blocks party 🥳

### 2. Gradio ONLY works with PyTorch models
If you want to put the knowledge from this chapter to good use, come join the Gradio blocks party! This is a community event that's hosted by Hugging Face on **May 16-31**. During this event, you'll build cool machine learning demos with Gradio and be in the running to win Hugging Face swag and prizes!

<Question
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: true
}
]}
/>

### 3. Where can you launch a Gradio demo from?

<Question
choices={[
{
text: "Standard python IDEs",
explain: "Gradio works great with your favorite IDE.",
correct: true
},
{
text: "Google Colab notebooks",
explain: "You can create and launch a demo within your Google colab notebook.",
correct: true
},
{
text: "Jupyter notebooks",
explain: "Good choice - You can create and launch a demo within your Jupyter notebook.",
correct: true
}
]}
/>

### 4. Gradio is designed primarily for NLP models

<Question
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: true
}
]}
/>

### 5. Which of the following features are supported by Gradio?

<Question
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: true
},
{
text: "State for data persistance",
explain: "Gradio is capable of adding state to your interface.",
correct: true
},
{
text: "Username and passwords authentication",
explain: "Pass in a list of username/password tuples to the launch method to add authentication.",
correct: true
},
{
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 gr.Interface.load() method",
correct: true
}
]}
/>

### 6. Which of the following are valid ways of loading a Hugging Face model from Hub or Spaces?

<Question
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: true
},
{
text: "gr.Interface.load('model/{user}/{model_name}')",
explain: "This is a valid method of loading a Hugging Face model from the Hub",
correct: true
},
{
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: true
}
]}
/>

### 7. Select all the steps necessary for adding state to your Gradio interface

<Question
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: true
},
{
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: true
},
{
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: true
}
]}
/>

### 8. Which of the following are components included in the Gradio library?

<Question
choices={[
{
text: "Textbox.",
explain: "Yes, you can create textboxes with the Textbox component.",
correct: true
},
{
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: true
},
{
text: "Audio.",
explain: "Yes, you can create an audio upload widget with the Audio component.",
correct: true
},
]}
/>

### 9. What does Gradio `Blocks` allow you to do?

<Question
choices={[
{
text: "Combine multiple demos into one web app",
explain: "You can use the `with gradio.Tabs():` to add tabs for multiple demos",
correct: true
},
{
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: true
},
{
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: true
},
{
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: true
},
]}
/>

### 10. You can share a public link to a `Blocks` demo and host a `Blocks` demo on Hugging Face spaces.

<Question
choices={[
{
text: "True",
explain: "Just like `Interface`, all of the sharing and hosting capabilities are the same for `Blocks` demos!",
correct: true
},
{
text: "False",
explain: "Just like `Interface`, all of the sharing and hosting capabilities are the same for `Blocks` demos!",
correct: false
}
]}
/>
Check out the [event description](https://github.com/AK391/community-events/blob/main/gradio-blocks/README.md) for details on how to participate - we can't wait to see what you'll build 🤗!
Loading

0 comments on commit e6d0531

Please sign in to comment.