Giter Site home page Giter Site logo

raidin / keras-flask-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.98 MB

Object Detection REST full API Using Keras + Flask + uWSGI + nginx

Python 52.23% HTML 10.60% Shell 5.29% CSS 14.07% JavaScript 17.81%
object-detection keras flask uwsgi-nginx flask-restful

keras-flask-api's Introduction

Flask_Practice

Object Detection REST full API Using Keras + Flask + uWSGI + nginx

Environments

  • Ubuntu 16.04
  • python 3.7
  • virtualenv

Requirements

  • Flask==1.1.1
  • h5py==2.10.0
  • Keras==2.3.1
  • matplotlib==3.1.1
  • numpy==1.16.5
  • opencv-python==4.1.1.26
  • opencv-contrib-python==4.1.1.26
  • pandas==0.25.1
  • Pillow==6.2.0
  • tensorflow-gpu==2.0.0
  • tqdm==4.37.0
  • uWSGI==2.0.18

How to Use

  • Install library

    $ cd [Path to project]
    $ virtualenv [env_name] --python=python3.7
    $ source [env_name]/bin/activate
    $ pip install -r requirements.txt
  • Install Flask, uWSGI, nginx

    $ source [env_name]/bin/activate
    $ pip install Flask
    $ pip install uWSGI
    $ sudo apt install nginx
    
    # nginx status check
    $ sudo service nginx status
  • Setting Config

    • Manually
    $ cd setting_files
    
    # systemd uwsgi service setting
    sed "s/\[user_name\]/$USER_NAME/g" flaskapp.service.ori > flaskapp.service
    sed -i "s/\[path_to_project\]/\/home\/$USER_NAME\/keras-flask-api/g" flaskapp.service
    sed -i "s/\[path_to_virtualenv]/\/home\/$USER_NAME\/$ENV_NAME/g" flaskapp.service
    
    sudo cp flaskapp.service /etc/systemd/system/
    rm flaskapp.service
    
    sudo systemctl enable flaskapp
    sudo systemctl start flaskap
    
    # nginx service setting
    sudo cp custom_timeout.conf /etc/nginx/conf.d/
    
    sed "s/\[path_to_project\]/\/home\/$USER_NAME\/keras-flask-api/g" nginx_server.ori > nginx_detection_server
    
    sudo cp nginx_detection_server /etc/nginx/sites-available/
    sudo rm /etc/nginx/sites-enabled/*
    sudo ln -s /etc/nginx/sites-available/nginx_detection_server /etc/nginx/sites-enabled/nginx_detection_server
    
    rm nginx_detection_server
    • Using script
    $ cd setting_files
    $ ./set_config.sh [user name] [virtualenv name]
  • Server Operation

    • Manually
    # server start
    $ sudo service nginx start
    $ sudo service flaskapp start
    
    # server stop
    $ sudo service nginx stop
    $ sudo service flaskapp stop
    
    # server restart
    $ sudo service nginx restart
    $ sudo service flaskapp restart
    
    • Using script
    $ cd [path to proejct]
    $ ./server_restart.sh

keras-flask-api's People

Contributors

raidin avatar

Watchers

 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.