π (Work in Progress Project) Full application for auto-rotating images using RotNet.
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.
Coming soonβ¦
Usage of virtualenv is recommended for package library / runtime isolation.
To run the server, please execute the following from the root directory:
api folder. cd api/
Setup virtual environment.
Install dependencies.
pip3 install -r requirements.lock
python3 -m src
Or just simply run the docker-compose script from the root directory.
docker-compose up -d --build
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. |
curl -d '{"image_url": URL}' -H "Content-Type: application/json" -X POST https://public-endpoint.com/rotate
{
"error": false,
"response": {
"image_base64": "IMAGE_RESULT_ENCODED_IN_BASE64"
}
}
Run Auto Rotate locally.
Run tests from api module.
python3 -m unittest discover -v
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)
Again, kudos to Daniel Saez for this amazing model that he came up.
MIT Β© Auto Rotate