GithubHelp home page GithubHelp logo

image-repository's Introduction

Image Repository

Setup

In order to run this project, clone this repo

$ git clone [email protected]:amanbrar1999/image-repository.git
$ cd image-repository

Requirements can be installed using the requirements.txt file. You may want to set up a virtual environment to do so

$ python3 -m venv venv
$ . venv/bin/activate
(venv) $ pip3 install -r requirements.txt

Now, you can initialize the database and run the app with:

$ export FLASK_APP=image_repo
$ export FLASK_ENV=development
$ flask init-db
$ flask run

Functionality

This application currently supports the following functionality:

  • Adding image to database
  • Removing image from database
  • Viewing images in database

Endpoints

GET / healthcheck endpoint to ensure the application is running with a simple get request

POST /add adding image paths to the database. data must be of the form {"paths": ["path/to/image"]}, and the image must be stored under image_repo/static

POST /delete removing image paths from the database. data must be of the form {"paths": ["path/to/image"]}

GET /view view all image paths in the database. Individual images can be queried with query parameter image

GET /view/images view html page of all images in the database. Individual images can be queried with query parameter image

Testing

Unit and integration tests have been included in the tests/ directory. Tests can be ran using the following command in the root directory:

$ PYTHONPATH=. pytest

Manual testing can be performed through command line using curl. An example request can be made as follows:

$ curl -X POST -H "Content-Type: application/json" -d '{"paths": ["bulbasaur.jpg"]}' http://localhost:5000/delete

Future Improvements for Productionizing

As of now, file paths are stored in the database and the actual images are stored locally. A possible solution to make this better for a production environment is to store images in a cloud storage system such as AWS S3, and store the S3 file paths within the database instead of the current local filepaths.

image-repository's People

Contributors

amanbrar1999 avatar

Watchers

 avatar  avatar

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.