Deploying Gradio on Ubuntu 22.04 A developer has published a guide for deploying a GFPGAN-powered face-restoration demo using Gradio on Ubuntu 22.04. The setup includes running the app as a systemd service and exposing it through Nginx with TLS. The guide covers installing dependencies, creating the app, and configuring the server. Gradio is a Python library for wrapping any ML model in a web interface, ready to deploy and scale as an app. This guide builds a GFPGAN-powered face-restoration demo with Gradio on Ubuntu 22.04, runs it as a systemd service, and exposes it through Nginx with TLS. Prerequisites:a GPU-enabled Ubuntu 22.04 server, a domain A record e.g. gradio.example.com , non-root sudo access, Nginx installed. 1. Install dependencies: bash $ pip3 install realesrgan gfpgan basicsr gradio realesrgan — background restoration gfpgan — face restoration basicsr — provides RRDBNet , the super-resolution architecture GFPGAN relies on gradio — the web interface 2. GFPGAN's pandas dependency needs jinja2 = 3.1.2: bash $ pip show jinja2 Upgrade if it's older: bash $ pip install --upgrade jinja2 3. Create the project directory: bash $ sudo mkdir -p /opt/gradio-webapp/ $ sudo chown -R :$ id -gn /opt/gradio-webapp/ $ sudo chmod -R 775 /opt/gradio-webapp/ Uploads a face image and returns two enhanced outputs. bash $ cd /opt/gradio-webapp/ $ nano app.py python import gradio as gr from gfpgan import GFPGANer from basicsr.archs.rrdbnet arch import RRDBNet from realesrgan import RealESRGANer import numpy as np import cv2 import requests def enhance image input image : arch = 'clean' model name = 'GFPGANv1.4' gfpgan checkpoint = 'https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth' realersgan checkpoint = 'https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN x2plus.pth' rrdbnet = RRDBNet num in ch=3, num out ch=3, num feat=64, num block=23, num grow ch=32, scale=2 bg upsampler = RealESRGANer scale=2, model path=realersgan checkpoint, model=rrdbnet, tile=400, tile pad=10, pre pad=0, half=True restorer = GFPGANer model path=gfpgan checkpoint, upscale=2, arch=arch, channel multiplier=2, bg upsampler=bg upsampler input image = input image.astype np.uint8 cropped faces, restored faces, restored img = restorer.enhance input image return restored faces 0 , restored img interface = gr.Interface fn=enhance image, inputs=gr.Image , outputs= gr.Image , gr.Image , live=True, title="Face Enhancement with GFPGAN", description="Upload an image of a face and see it enhanced using GFPGAN. Two outputs will be displayed: restored faces and restored img." interface.launch server name="0.0.0.0", server port=8080 enhance image loads the GFPGAN/Real-ESRGAN checkpoints and runs restoration; interface wires that function to a Gradio UI listening on port 8080. Test it: bash $ python3 app.py Running on local URL: http://0.0.0.0:8080 Set share=True in launch for a temporary public Gradio link. Stop it with Ctrl+C once verified. bash $ sudo nano /etc/systemd/system/my gradio app.service Replace example-user with your actual account: Unit Description=My Gradio Web Application Service ExecStart=/usr/bin/python3 /opt/gradio-webapp/app.py WorkingDirectory=/opt/gradio-webapp/ Restart=always User=example-user Environment=PATH=/usr/bin:/usr/local/bin Environment=PYTHONUNBUFFERED=1 Install WantedBy=multi-user.target bash $ sudo systemctl daemon-reload $ sudo systemctl enable my gradio app $ sudo systemctl start my gradio app $ sudo systemctl status my gradio app bash $ sudo nano /etc/nginx/sites-available/gradio.conf server { listen 80; listen :: :80; server name gradio.example.com; location / { proxy pass http://127.0.0.1:8080/; } } bash $ sudo ln -s /etc/nginx/sites-available/gradio.conf /etc/nginx/sites-enabled/ $ sudo nginx -t $ sudo systemctl restart nginx bash $ sudo ufw status $ sudo ufw allow 80/tcp $ sudo ufw allow 443/tcp $ sudo ufw reload $ sudo apt install -y certbot python3-certbot-nginx $ sudo certbot --nginx -d gradio.example.com -m admin@example.com --agree-tos $ sudo certbot renew --dry-run Visit https://gradio.example.com , upload a sample face image, and confirm you get back the restored face crop and the full restored image. The Gradio app is running as a managed systemd service behind Nginx with TLS. From here: interface.launch pattern works for any function-wrapped model interface.launch auth=... if the app shouldn't be fully publicFor the full guide, visit the original article on Vultr Docs .