Post-Quiz: Low-Code AI Toolsยถ

Phase 17: Low-Code AI Tools
Duration: 25 minutes
Questions: 18

Instructionsยถ

This quiz assesses your understanding after completing Phase 17.

  • Answer all questions

  • Reference course materials if needed

  • Select the best answer for each question

  • Aim for 80%+ to demonstrate mastery

Section 1: Gradio Fundamentals (Questions 1-5)ยถ

1. Which Gradio function creates a simple interface with a single function?ยถ

A) gr.Blocks()
B) gr.Interface()
C) gr.App()
D) gr.create()

Answer

B) gr.Interface()

gr.Interface() creates a simple interface by wrapping a function with input and output components.

2. What is the main advantage of gr.Blocks() over gr.Interface()?ยถ

A) Faster performance
B) More customizable layouts and complex workflows
C) Requires less code
D) Better mobile support

Answer

B) More customizable layouts and complex workflows

gr.Blocks() provides full control over layout and enables multi-step workflows, conditional displays, and custom arrangements.

3. Which component would you use for image classification output?ยถ

A) gr.Image()
B) gr.Text()
C) gr.Label()
D) gr.Plot()

Answer

C) gr.Label()

gr.Label() displays classification results with class names and confidence scores, perfect for classification tasks.

4. How do you create a custom theme in Gradio?ยถ

A) gr.Theme(primary_color="blue")
B) gr.themes.Soft()
C) Modify CSS directly
D) Both B and C

Answer

D) Both B and C

You can use built-in themes like gr.themes.Soft() or customize with CSS for complete control.

5. What is the purpose of providing examples in Gradio?ยถ

A) To train the model
B) To help users understand expected inputs
C) To validate inputs
D) To cache results

Answer

B) To help users understand expected inputs

Examples show users what kind of inputs work well and improve the user experience by providing ready-to-test data.

Section 2: Streamlit Applications (Questions 6-10)ยถ

6. What happens when a user interacts with any Streamlit widget?ยถ

A) Only that widget updates
B) The entire script reruns from top to bottom
C) The app crashes
D) Nothing happens

Answer

B) The entire script reruns from top to bottom

Streamlitโ€™s reactive model reruns the entire script whenever a widget changes, which is why caching and session state are important.

7. Which decorator should you use to cache a trained ML model in Streamlit?ยถ

A) @st.cache
B) @st.cache_data
C) @st.cache_resource
D) @st.memo

Answer

C) @st.cache_resource

@st.cache_resource is used for resources that should persist across reruns and not be copied, like ML models or database connections.

8. How do you organize content into tabs in Streamlit?ยถ

A) st.sidebar()
B) st.tabs(["Tab1", "Tab2"])
C) st.columns()
D) st.expander()

Answer

B) st.tabs([โ€œTab1โ€, โ€œTab2โ€])

st.tabs() creates tabbed sections, returning tab objects that can be used with context managers.

9. Whatโ€™s the correct way to persist a counter across Streamlit reruns?ยถ

A) Use a global variable
B) Use st.session_state.counter
C) Store in a file
D) Use @st.cache_data

Answer

B) Use st.session_state.counter

st.session_state is the proper way to persist values across reruns in Streamlit.

10. Which is better for displaying interactive plots in Streamlit?ยถ

A) matplotlib
B) seaborn
C) plotly
D) ASCII art

Answer

C) plotly

While Streamlit supports all plotting libraries, Plotly provides interactive features like zoom, pan, and hover that work seamlessly in Streamlit.

Section 3: Hugging Face Spaces (Questions 11-13)ยถ

11. What are the three main SDK options for Hugging Face Spaces?ยถ

A) Python, Java, JavaScript
B) Gradio, Streamlit, Docker
C) Flask, Django, FastAPI
D) React, Vue, Angular

Answer

B) Gradio, Streamlit, Docker

Hugging Face Spaces supports Gradio SDK, Streamlit SDK, Docker SDK, and Static (HTML) sites.

12. Where should you specify your Spaceโ€™s SDK in Hugging Face?ยถ

A) In requirements.txt
B) In README.md frontmatter
C) In app.py
D) In config.json

Answer

B) In README.md frontmatter

The README.md frontmatter (YAML at the top) specifies configuration like SDK type, version, and other metadata.

13. How do you manage sensitive API keys in a Hugging Face Space?ยถ

A) Hard-code them in app.py
B) Put them in README.md
C) Use Space Settings โ†’ Repository secrets
D) Include them in requirements.txt

Answer

C) Use Space Settings โ†’ Repository secrets

Repository secrets in Space Settings allow secure storage of API keys accessible via os.environ without exposing them in code.

Section 4: AutoML (Questions 14-16)ยถ

14. What does PyCaretโ€™s compare_models() function do?ยถ

A) Compares two specific models
B) Trains and evaluates multiple algorithms, returning the best
C) Only compares model sizes
D) Compares training times only

Answer

B) Trains and evaluates multiple algorithms, returning the best

compare_models() trains 10+ algorithms, evaluates them on various metrics, and returns the top performers sorted by your chosen metric.

15. In FLAML, what does the time_budget parameter control?ยถ

A) Total project timeline
B) Maximum seconds for AutoML search
C) Inference time per prediction
D) Data loading time

Answer

B) Maximum seconds for AutoML search

time_budget sets the maximum time (in seconds) FLAML will spend searching for the best model configuration.

16. Which AutoML platform is best for very large datasets?ยถ

A) PyCaret
B) FLAML
C) H2O AutoML
D) Manual GridSearch

Answer

C) H2O AutoML

H2O AutoML is designed for distributed computing and can handle very large datasets efficiently across clusters.

Section 5: Integration & Best Practices (Questions 17-18)ยถ

18. Which is a production-ready best practice?ยถ

A) Use random model predictions
B) Pin exact dependency versions
C) Never handle errors
D) Skip documentation

Answer

B) Pin exact dependency versions

Pinning exact versions (e.g., gradio==4.0.0) ensures reproducible builds and prevents breaking changes from updates.

Bonus Questions (Optional, +5 points each)ยถ

B1. How would you implement batch predictions in a Gradio app?ยถ

A) Run predict() in a loop
B) Use gr.File() for CSV upload, process DataFrame
C) Not possible in Gradio
D) Use multiple interfaces

Answer

B) Use gr.File() for CSV upload, process DataFrame

Accept a CSV file with gr.File(), read it into a DataFrame, run predictions on all rows, and return results as a downloadable file.

B2. Whatโ€™s the best way to explain model predictions to users?ยถ

A) Show only the prediction
B) Add SHAP values, feature importance, or confidence scores
C) Show model architecture
D) Display training data

Answer

B) Add SHAP values, feature importance, or confidence scores

Explanations like SHAP values, feature importance, and confidence scores help users understand and trust predictions.

B3. How can you reduce cold start time for a deployed ML app?ยถ

A) Use larger models
B) Cache model loading with @st.cache_resource or preload
C) Increase memory
D) Deploy multiple times

Answer

B) Cache model loading with @st.cache_resource or preload

Loading models once at startup and caching them prevents reload on every request, dramatically improving response time.

Scoring Guideยถ

Standard Questions (18 questions, 5 points each = 90 points):ยถ

  • 16-18 correct (85-100%): ๐Ÿ† Excellent! Youโ€™ve mastered low-code ML tools.

  • 14-15 correct (75-85%): โœ… Great! Solid understanding.

  • 11-13 correct (60-75%): ๐Ÿ“š Good! Review challenging topics.

  • Below 11 (< 60%): ๐Ÿ”„ Review course materials and retake.

Bonus Questions (3 questions, 5 points each = +15 points max):ยถ

  • Total possible: 105 points

Answer Summaryยถ

Quick reference (donโ€™t peek before completing!):

  1. B | 2. B | 3. C | 4. D | 5. B | 6. B

  2. C | 8. B | 9. B | 10. C | 11. B | 12. B

  3. C | 14. B | 15. B | 16. C | 17. B | 18. B
    B1. B | B2. B | B3. B

Weak Areas Review Guideยถ

If you missed questions in:

Section 1 (Gradio): Review Notebook 1

  • gr.Interface() vs gr.Blocks()

  • Component types

  • Themes and customization

Section 2 (Streamlit): Review Notebook 2

  • Rerun behavior

  • Caching strategies

  • Session state

  • Widgets and layout

Section 3 (Hugging Face): Review Notebook 3

  • Space configuration

  • Deployment process

  • Secrets management

Section 4 (AutoML): Review Notebook 4

  • PyCaret workflow

  • FLAML time budgets

  • Platform selection

Section 5 (Integration): Review Notebook 5

  • End-to-end workflow

  • Best practices

  • Production considerations

Next Stepsยถ

If you scored 85%+:ยถ

โœ… Youโ€™re ready for production ML app development!
โœ… Try the advanced challenges
โœ… Build and deploy your own project
โœ… Share your knowledge with others

If you scored 60-84%:ยถ

๐Ÿ“š Review sections where you struggled
๐Ÿ“š Revisit relevant notebooks
๐Ÿ“š Complete practice exercises
๐Ÿ“š Retake quiz in a few days

If you scored < 60%:ยถ

๐Ÿ”„ Review all course materials
๐Ÿ”„ Work through notebooks step-by-step
๐Ÿ”„ Complete challenges 1-3
๐Ÿ”„ Seek help from instructor/community
๐Ÿ”„ Retake quiz after review

Certificate Eligibilityยถ

To earn Phase 17 completion certificate:

  • Score 80%+ on this quiz

  • Complete assignment (70%+ grade)

  • Finish at least 3 challenges

Congratulations on completing Phase 17! ๐ŸŽ‰

Keep building amazing ML applications! ๐Ÿš€