Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions to Run the Code

1. Clone the repo and Change Directory to image_processor

git clone https://github.com/FaizAlam/image_processor.git && cd image_processor

2. Create a Virtual Python Environment

python3 -m venv myvenv

3. Activate the Environment

  • Windows:
    .\myvenv\Scripts\activate
  • macOS/Linux:
    source myvenv/bin/activate

4. Install Dependencies

pip install -r requirements.txt

5. Run the migration command

python3 manage.py migrate

6. Run the Django Server

python3 manage.py runserver

7. Run the Celery Worker

celery -A image_processor worker -l info

Testing

API Documentation

UPLOAD API

Endpoint: /upload/

Method: POST

Description: Upload a CSV file containing product information and image URLs. The system validates the CSV, stores the data, and asynchronously processes the images.

Request:

  • Headers:
    • Content-Type: multipart/form-data
  • Body:
    • file: The CSV file to be uploaded. It should contain columns Serial Number, Product Name, and Input Image Urls.

Response:

  • Success (200 OK): Returns a unique request_id that can be used to track the status of the image processing.
    {
      "request_id": "123e4567-e89b-12d3-a456-426614174000"
    }
  • Error:
    • File not provided
    • CSV validation failed
    • Internal server error

GET STATUS API

Endpoint: /status/<request_id>/

Method: GET

Description: Check the status of the image processing request using the request_id returned by the upload API.

Request:

  • Headers:
    • Content-Type: application/json
  • Parameters:
    • request_id: UUID of the processing request.

Response:

  • Success (200 OK):

    {
      "request_id": "1ded0e1c-83a5-4a4f-bcd8-2871bc0b9299",
      "status": "Completed",
      "images_processed": 14,
      "images_total": 14
    }

    or

    {
      "request_id": "1ded0e1c-83a5-4a4f-bcd8-2871bc0b9299",
      "status": "Pending",
      "images_processed": 1,
      "images_total": 14
    }
  • Error:

    • Wrong request_id

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages