8000 GitHub - puryagh/identifile: FastAPI web api for identifying submitted file type by it content.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

puryagh/identifile

Repository files navigation

IdentiFile

IdentiFile is a REST API for identifying file types based on their content using Google Magika AI or standard file header detection. Files are submitted as multipart/form-data.

License: GPL v3

Features

  • Standard Identification: Identifies files based on their content type headers
  • AI-Powered Identification: Uses Google's Magika AI for more accurate file type detection
  • Simple REST API: Easy to integrate with any application
  • Docker Support: Run as a containerized service

API Endpoints

Endpoint Method Description
/version GET Get API version information
/identify POST Identify file using standard header detection
/ai_identify POST Identify file using Google Magika AI

Quick Start

Using Docker

# Build the Docker image
make docker-build

# Run the Docker container
make docker-start

The API will be available at http://localhost:8079

Local Development

Prerequisites

  • Python 3.9+
  • Make

Setup

  1. Clone the repository

    git clone https://github.com/yourusername/identifile.git
    cd identifile
  2. Create and activate a virtual environment

    python -m venv env
    source ./env/bin/activate  # On Windows: .\env\Scripts\activate
  3. Install dependencies

    make pip-upgrade
    make pip-install
  4. Start the development server

    make dev

The API will be available at http://localhost:8080

Usage Examples

Identify a file using standard detection

curl -X POST -F "file=@/path/to/your/file.jpg" http://localhost:8080/identify

Identify a file using AI detection

curl -X POST -F "file=@/path/to/your/file.jpg" http://localhost:8080/ai_identify

Response Format

{
  "method": "ai_identify",
  "mime": "image/jpeg",
  "score": 0.99,
  "description": "JPEG image",
  "label": "jpeg",
  "group": "image",
  "size": 12345,
  "filename": "example.jpg"
}

Built With

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

About

FastAPI web api for identifying submitted file type by it content.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0