Magika is Google's ML based File type Detection model in near constant inference time regardless of file sizes. Utilizes upload api in swagger to return detected File Type. Supports Python 3.8 to 3.11. Works on Linux, Windows and Mac.
Magika File Type Checker by Google
You can find the api documentation or openAPI docs at
http://127.0.0.1/api/docs
You can create an isolated virtual environment using Python 3.11 and install packages using pip or pipenv.
Python API Usage
cd example
python manage.py runserver
You can Ignore migration not applied warnings after running runserver
Deployed using Granian Server instead of Gunicorn
docker ps
docker compose up --build -d
docker exec -it bash
To view logs of container. You can pass head to view first N lines or tail to view last N lines specified by argument after head/tail
@software{magika, author = {Fratantonio, Yanick and Bursztein, Elie and Invernizzi, Luca and Zhang, Marina and Metitieri, Giancarlo and Kurt, Thomas and Galilee, Francois and Petit-Bianco, Alexandre and Farah, Loua and Albertini, Ange}, title = {{Magika content-type scanner}}, url = {https://github.com/google/magika} }