Run Gradio on Local Computer

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

With Gradio installed, you can run a test on the local computer.

1. Launch the Web interface from a Python script:

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

>>> import gradio as gr

>>> def greet(name):
>>>     return "Hello " + name + "!!"

>>> iface = gr.Interface(fn=greet, inputs="text", outputs="text")
>>> iface.launch(share=True)
Running on local URL:  http://127.0.0.1:7860/

To create a public link, set `share=True` in `launch()`.
(<Flask 'gradio.networking'>, 'http://127.0.0.1:7860/', None)

2. Start a Web browser on the local computer and enter http://127.0.0.1:7860/ as the address. I see the Gradio Web interface with one input field "NAME".

3. Enter "Herong" in "NAME" and click "Submit". I see "Hello Herong!!" in the "OUTPUT".

Cool, the Gradio Web interface is working!

Gradio Web Interface for Python Scripts
Gradio Web Interface for Python Scripts

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