gurland / image_search_engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image_search_engine

Backend documentation

The heartbeat route is a simple endpoint that can be used to check if the API is up and running. It returns a JSON object with the message "Api is running" and a HTTP status code of 200.

The post_image_to_index route is used to add images to the index. The route expects a JSON payload in the request body with the key "url" which should contain the url of the image that needs to be indexed. The function extract_features is called with the image url, which extracts the features from the image at the provided url. The function add_image_to_index is called with the extracted features, image url, and metadata(if provided), which adds the image to the index. If the payload does not contain a "url" key, the function returns a JSON object with the message "No url provided" and a HTTP status code of 400. If any exception occurs in the process, the function returns a JSON object with the error message and a HTTP status code of 400.

The search_simmilar_images route is used to search for similar images in the index. The route expects a JSON payload in the request body with the key "url" and "metadata" which should contain the url of the image and metadata for which similar images need to be searched. The function extract_features is called with the image url, which extracts the features from the image at the provided url. The function search_image is called with the extracted features and metadata, which returns the search results for similar images. If the payload does not contain a "url" key, the function uses the metadata to search for similar images. If any exception occurs in the process, the function returns a JSON object with the error message and a HTTP status code of 400.

The run_object_detection route is used to run object detection on an image. The route expects a JSON payload in the request body with the key "url" which should contain the url of the image on which object detection needs to be run. The function run_detector is called with the image url, which runs object detection on the image and returns the filepath of the image with the object detection. The returned filepath is sent as a response to the client with the mime-type "image/jpg". If the payload does not contain a "url" key, the function returns a JSON object with the message "url not provided error" and a HTTP status code of 400. If any exception occurs in the process, the function returns a JSON object with the error message and a HTTP status code of 400.

About


Languages

Language:TypeScript 52.0%Language:Python 36.3%Language:HTML 5.9%Language:CSS 5.3%Language:Dockerfile 0.6%