askaresh / MS-Florence2

Microsoft Florence 2 in a Docker with Chainlit UI
5 stars 0 forks source link

Comprehensive Image Analysis API with Microsoft Florence-2-large, Chainlit, and Docker

Welcome to our project where we build a comprehensive Image Analysis API using Microsoft Florence-2-large, Chainlit, and Docker. This API allows you to perform various image analysis tasks such as captioning, object detection, expression segmentation, and OCR.

My Blog Link

Link - https://askaresh.com/2024/07/08/building-a-comprehensive-image-analysis-api-with-microsoft-florence-2-large-chainlit-and-docker/

Model Overview

We utilized the pre-trained Florence-2-large model from Hugging Face Transformers for image analysis. This powerful model has been trained on a vast dataset of images and can perform multiple tasks such as image captioning, object detection, and OCR.

Implementation Details

Task Prompts

We defined several task prompts to leverage the Florence-2-large model's capabilities. These prompts include:

Setup Instructions

  1. Clone the repository:

    
    git clone https://github.com/yourusername/MS-FLORENCE2.git
    cd MS-FLORENCE2
  2. (Optional) - File now included in the repo - Create a .env file with the following content: env Copy code MODEL_ID=microsoft/Florence-2-large RATE_LIMIT=5

  3. Build the Docker container: docker build -t florence2-image-analysis .

  4. Run the Docker container: docker run --gpus all -p 8010:8010 florence2-image-analysis

Running the Application

Once the container is running, access the Chainlit interface at http://localhost:8010. Follow the instructions in the chat to perform various image analysis tasks.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request for any enhancements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.