Giter VIP home page Giter VIP logo

rdi_app_repo's Introduction

Hussien UI/API server

Description

This is a tutorial on how to design a simple server using flask,gevent and docker and how to handle its simple error cases.

Contents

Structure

main.py => The main file of the server containing the requests, functions and error handlers.

test_api.py => the test script for ci cd

Dockerfile => contain the serve in the format of Dockerfile Image

Requirements => Contain the libraries needed to be installed to run our server.

Endpoints

Alive[/alive]

This endpoint checks whether the server is alive

Request URL:

http://18.144.5.195/alive

Request Parameters

NA

Request Body

NA

Request Response

200 OK

Representation

{
  "status": "alive"
}

API test command

curl -X 'POST' \
  'http://18.144.5.195/alive' \
  -H 'accept: application/json' \
  -d ''

upload_image_to_predict[/upload-file_api]

This endpoint takes a text and transform it into its coorresponding asmo.

Request URL: http://18.144.5.195/upload-file_api/

Request Parameters

NA

Request Body

image file to predict format jpg

API test command

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

string: This should be either an arabic text, an english text or english numbers.

Request Response

200 OK

Representation

{
  "Prediction Resut": "COVID"
}

Erro handlers

404 In case of using a wrong endpoint.

Representation

"error":"wrong endpoint",
"Description":"you tried to access an undefined endpoint"

405 In case of using a sending unsupported data.

Representation

"error":"Unsupported input type",
"Description":"Description":"you tried to send an Unsupported input type"

500 In case of internal server error.

Representation

"error":"Internal server error",
"Description":"An internal server error has occured"

UI

http://18.144.5.195/

CI/CD

  • this is made by github actions

Stages

check ci_cd.png image

image

CI

in this step we install the requirments in the repo then make tests wiht pytest for the apis post functions like checking server is alive, and prediction on dumy image on the image to check the model load and predictions

CD

in this step we deploy to the aws server and setup our docker using docker-compuse then run the docker instance

Script

action_script

rdi_app_repo's People

Contributors

ahmedhessuin avatar

Watchers

James Cloos 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.