App inspired by the work of Deepanshu Thakur and Simon Willison
This webapp was created on behalf of the British Library Endangered Archive Programme to determine the orientation of images in their collection. The deep learning model is based on a 50-layer version of resnet and was trained on around 650 unique images from the EAP archives using the fast.ai library. Each image is duplicated into four representations, consisting of the application of 0, 90, 180 or 270 degrees of anti-clockwise rotation.
The 99MB pre-trained model is included in this package and is found within resnet50_EAP_version6.pkl
imgapp.py
is a Starlette API server which accepts image uploads or image URLs and runs them against the pre-calculated model.
A Dockerfile
is included for convenience.
If deploying on a server, run the Starlette app on the uvicorn ASGI server behind an nginx reverse proxy
cd $APP_DIR
sudo apt-get install nginx
(sudo) cp nginx_config_file.conf /etc/nginx/sites-available/default
sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/
Before this step, edit the nginx config file ip addresses to match your setup
sudo nginx -t
sudo /etc/nginx/init.d/nginx reload
Check the status of nginx
sudo systemctl status nginx
Start the server
sudo systemctl start nginx
Configure nginx to automatically start on system startup sudo systemctl enable nginx