Code Monkey home page Code Monkey logo

turingapi's Introduction

FastAPI Image Detection Project

This is a FastAPI project that provides an endpoint for image detection using a YOLOv4 model. It accepts image uploads and returns bounding boxes for detected objects.

Before running the project, ensure you have the necessary dependencies installed. You can install them using pip:

Prerequisites

pip install -r requirements.txt

Running the Project

To run the project, use the following command:

uvicorn main:app --host 0.0.0.0 --port 8000 --reload

This will start the FastAPI application and make it accessible at http://localhost:8000. You can explore the API and its functionality using FastAPI's built-in Swagger UI. Simply visit http://localhost:8000/docs in your browser to access the API documentation.

Usage

POST /detect

This endpoint allows you to upload an image and receive bounding boxes for detected objects. You can also specify a detection threshold (default is 0.25).

Request:
    Upload an image file (jpg or png format).
    Optionally, provide the threshold query parameter (0.0 to 1.0) to adjust the detection threshold.

Response:
    The response contains the number of detections and a list of detected objects with their bounding box coordinates and labels.

Example:

curl -X 'POST' \
  'http://0.0.0.0/detect' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F '[email protected];type=image/jpeg'
  

Docker

You can also run the project using Docker. To do so, first build the Docker image:

docker build -t fastapi-image-detection .

Then run the container:

docker run -p 8000:8000 fastapi-image-detection

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.