Overview#
In the following article, I introduced a Gradio app using Azure virtual machines and NDLOCR.
This article provides notes on how to build this app.
Building the Virtual Machine#
To use a GPU, it was necessary to request a quota.


After the request, “NC8as_T4_v3” was used for this project.

Building the Docker Environment#
The following article was used as a reference.
https://zenn.dev/koki_algebra/scraps/32ba86a3f867a4
Disabling Secure Boot#
The following is stated:
Secure Boot must be disabled for the NVIDIA Driver to be installed correctly.
Indeed, when it was not disabled, the following screen appeared and I could not proceed.

Secure Boot is disabled as follows.

Installing the NVIDIA Driver#
Install the ubuntu-drivers command and check the available NVIDIA Drivers.
The results are as follows.
Install the recommended driver.
After restarting, run the following to confirm the installation.
Installing Docker#
Install following the official documentation.
https://docs.docker.com/engine/install/ubuntu/
Add azureuser to the Docker Group. Then restart Docker.
Reconnect via SSH.
Install following the official documentation.
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
Configuring Docker#
Domain Configuration#
The Gradio app created this time is secured with HTTPS using Traefik.
Here, Route53 is used to assign a domain to the virtual machine’s IP address.
Starting the NDLOCR App#
The above completes the environment setup. Now let’s start the NDLOCR app.
Download the source code with the following command.
Downloading the Gradio App Source Code#
The Gradio app source code is published at the following URL.
https://github.com/nakamura196/ndlocr2_gradio
Download it and copy it to the appropriate location.
Then, modify the domain name and email address in ./traefik/traefik.yml and ./docker-compose.yml.
Then, run the following.
This will start the Gradio app at the configured URL. Here is an example.
https://ndlocr.aws.ldas.jp/

Summary#
There may be some incomplete parts, but I hope this serves as a useful reference for converting the NDLOCR app into a Gradio app.