Skip to content

AlbertSuarez/auto-rotate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Auto Rotate

HitCount contributions welcome Python application GitHub stars GitHub forks GitHub license

๐Ÿ” (Work in Progress Project) Full application for auto-rotating images using RotNet.

Motivation

This repository came up after seeing the amazing work that Daniel Saez did with the RotNet model for predicting the rotation angle of an image to correct its orientation. I wanted to understand how it actually works and build a easier UI for running inference no matter the knowledge that you have about it to make this more accessible to the community.

Examples

Coming soon...

API

Requirements

  1. Python 3.7+.
  2. docker.
  3. docker-compose.

Recommendations

Usage of virtualenv is recommended for package library / runtime isolation.

Usage

To run the server, please execute the following from the root directory:

  1. Change directory into the api folder.
cd api/
  1. Setup virtual environment.

  2. Install dependencies.

pip3 install -r requirements.lock
  1. Run API server as a python module.
python3 -m src

Or just simply run the docker-compose script from the root directory.

docker-compose up -d --build

Endpoints

Rotate

Rotate an image given its URL or the image itself.

Key Type Description
image_url string Internet accessible URL of an image.
image_base64 string URL and filename - safe base64(url) encoded image.
Request example
curl -d '{"image_url": URL}' -H "Content-Type: application/json" -X POST https://public-endpoint.com/rotate
Response example
{
    "error": false,
    "response": {
        "image_base64": "IMAGE_RESULT_ENCODED_IN_BASE64"
    }
}

Run tests

  1. Run Auto Rotate locally.

  2. Run tests from api module.

    python3 -m unittest discover -v
    

Development

How to add a new test

Create a new Python file called test_*.py in test.* (inside api folder) with the following structure:

import unittest


class NewTest(unittest.TestCase):

    def test_v0(self):
        expected = 5
        result = 2 + 3
        self.assertEqual(expected, result)

Merits

Again, kudos to Daniel Saez for this amazing model that he came up.

License

MIT ยฉ Auto Rotate

About

๐Ÿ” Full application for auto-rotating images using RotNet

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages