What Is Gradio

This section describes what is 'Gradio' and how to install it in Python 3.8.7 Conda environment.

What Is Gradio? - Gradio is the fastest way to demo your machine learning model with a friendly web interface so that anyone can use it, anywhere.

Here is what I did to install Gradio.

1. Try to install "gradio" package. But it failed on the "cryptography" package.

herong$ sudo pip3 install gradio 

...
Collecting cryptography>=2.5 (from paramiko->gradio)
Complete output from command python setup.py egg_info:
...
File "/tmp/pip-build-0a3_zkni/aiohttp/aiohttp/hdrs.py", line 8, ...
  from multidict import istr
ModuleNotFoundError: No module named 'multidict'

2. Try to install "cryptography" package. It is already installed.

herong$ sudo pip3 install cryptography
Requirement already satisfied: 
  cryptography in /usr/lib64/python3.6/site-packages
  idna>=2.1 in /usr/lib/python3.6/site-packages (...
  asn1crypto>=0.21.0 in /usr/lib/python3.6/site-packages (...
  six>=1.4.1 in /usr/lib/python3.6/site-packages (...
  cffi!=1.11.3,>=1.7 in /usr/lib64/python3.6/site-packages (...
  pycparser in /usr/lib/python3.6/site-packages (...

herong$ python 
>>> import cryptography
>>> cryptography.v1.22
'3.4.8'

3. Install in a Conda environment.

herong$ conda activate tensor 
(tensor) herong$ pip3 install gradio 
...
Successfully installed Flask-2.0.2 Flask-Cors-3.0.10 Flask-Login-0.5.0
  analytics-python-1.4.0 backoff-1.10.0 bcrypt-3.2.0 click-8.0.3
  cryptography-36.0.1 ffmpy-0.3.0 flask-cachebuster-1.0.0 gradio-2.6.3
  itsdangerous-2.0.1 markdown2-2.4.2 monotonic-1.6 paramiko-2.9.1
  pycryptodome-3.12.0 pydub-0.25.1 pynacl-1.4.0 

4. Try it out. But there is syntax error.

(tensor) herong$ python 
Python 3.6.13 |Anaconda, Inc.| (default, Jun  4 2021, 14:25:59) 

>>> import gradio 
Traceback (most recent call last):
  File "/home/herong/.local/lib/python3.6/site-packages/gradio/...
    from gradio.interface import *  # This makes it possible to ...
  File "/home/herong/.local/lib/python3.6/site-packages/gradio/...
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined

5. Try it in a newer Python environment.

herong$ conda activate flow 
(flow) herong$ pip3 install gradio 
...

(flow) herong$ python 
Python 3.9.7 | packaged by conda-forge | ...

>>> import gradio 
>>> gradio.v1.22
'2.6.3'

Cool, I have installed gradio 2.6.3 in my Python 3.8.7 Conda environment.

Table of Contents

 About This Book

 Deep Playground for Classical Neural Networks

 Building Neural Networks with Python

 Simple Example of Neural Networks

 TensorFlow - Machine Learning Platform

 PyTorch - Machine Learning Platform

Gradio - ML Demo Platform

What Is Gradio

 Run Gradio on Local Computer

 CNN (Convolutional Neural Network)

 RNN (Recurrent Neural Network)

 GNN (Graph Neural Network)

 GAN (Generative Adversarial Network)

 Performance Evaluation Metrics

 References

 Full Version in PDF/EPUB