Flask RestAPI Project - Transimage Rest API For Python

Overview

[ 이미지 변환 플라스크 Rest API ver01 ]

0. Flask Rest API - in SunnyWeb : 이미지 변환 웹의 Flask Rest API

1. 구성

    1. flaskRestAPI01 : 이미지 변환 기능 중 유명 화가풍으로 변환, 안경과 동물들의 특징을 이미지에 추가하는 기능을 담당하는 flask Rest API
  • a) imgs : 안경, 돼지(코), 쥐(코, 귀) 이미지
  • b) models
    • b-1) instance_norm
    • b-2) eccv16
  • c) api_test01.py : json으로 request를 주었을 때를 테스트하는 모듈
  • d) app01.py : flask로 웹 서버를 올려 json request를 json response를 보내주는 flask Rest API
  • e) img_download.py : s3에서 이미지를 다운 받아서 임시 저장소에 이미지를 저장하는 함수를 가진 모듈
  • f) plusimage.py : 이미지와 파일 이름을 넣으면 이미지를 추가해주는 함수를 가진 모듈
  • g) total_pram : Rest API를 쉽게 사용할 수 있도록 조절할 파라미터만 모아 놓은 모듈
  • h) transiamge : 이미지와 파일 이름을 넣으면 이미지를 변환해주는 함수를 가진 모듈
  • i) upload_image : AWS S3의 버켓에 이미지를 업로드 하는 함수를 가진 모듈
  1. flaskRestAPI01 : 이미지 변환 기능 중 저화질의 이미지를 초고화질로 바꿔주는 기능을 담당하는 flask Rest API
a) api_test02.py : json으로 request를 주었을 때를 테스트하는 모듈
b) app02.py : flask로 웹 서버를 올려 json request를 json response를 보내주는 flask Rest API
c) img_download.py : s3에서 이미지를 다운 받아서 임시 저장소에 이미지를 저장하는 함수를 가진 모듈
d) total_pram : Rest API를 쉽게 사용할 수 있도록 조절할 파라미터만 모아 놓은 모듈
e) upload_image : AWS S3의 버켓에 이미지를 업로드 하는 함수를 가진 모듈 

2. 핵심 기능 및 파라미터 설명

  1. app01.py, app02.py

a) route /transimage : 이미지를 유명 화가풍으로 변환해주는 app

image

b) route /plussimage : 이미지에 쥐(코, 귀)의 이미지를 추가해주는 app

image

c) route /esrganimage : 저화질의 이미지를 초고화질의 이미지로 변환해주는 app

1. 라이브러리

  1. flask
  2. boto3
  3. openCV
  4. numpy
  5. dlib
  6. tansorflow

2. Rest API 조절 파라미터

  1. download_url = "다운로드 받을 url"
  2. s3_upload_bucket_name = "s3에 업로드할 버켓 이름"
  3. trans_image_model = "변환할 모델"
  • 변환 가능한 모델 리스트 : composition_vii.t7, la_muse.t7, starry_night.t7, the_wave.t7,

candy.t7, feathers.t7, la_muse.t7, mosaic.t7, starry_night.t7, the_scream.t7, udnie.t7

3. 프로세스 및 예시

  1. json으로 이미지 파일의 이름을 보낸다.

json1

  1. json으로 받은 이미지의 이름으로 s3에서 찾아 임시저장소에 다운로드한다.

업로드된원본

  1. 임시 저장한 이미지를 변환한 후에 이미지를 잠시 로컬에 저장한다.
  2. 변환된 이미지를 s3에 업로드한다.

변환된이미지업로드

  1. 업로드 후 변환된 이미지를 삭제한다.
  2. 변환된 이미지의 이름을 json으로 보낸다.

json2

결과

변환전후

참고 사이트

  1. http://amroamroamro.github.io/mexopencv/opencv/dnn_style_transfer.html
Owner
OliverKim
안녕하세요!
OliverKim
Turn your API made with Django REST Framework(DRF) into a GraphQL like API.

Turn your API made with Django REST Framework(DRF) into a GraphQL like API.

Yezy Ilomo 575 Jan 05, 2023
Kong API Manager with Prometheus And Splunk

API Manager Stack Run Kong Server + Konga + Prometheus + Grafana + API & DDBB + Splunk Clone the proyect and run docker-compose up

Santiago Fernandez 82 Nov 26, 2022
Estudo e desenvolvimento de uma API REST

Estudo e desenvolvimento de uma API REST 🧑‍💻 Tecnologias Esse projeto utilizará as seguintes tecnologias: Git Python Flask DBeaver Vscode SQLite 🎯

Deusimar 7 May 30, 2022
Async Python 3.6+ web server/framework | Build fast. Run fast.

Sanic | Build fast. Run fast. Build Docs Package Support Stats Sanic is a Python 3.6+ web server and web framework that's written to go fast. It allow

Sanic Community Organization 16.7k Dec 28, 2022
Django-rest-auth provides a set of REST API endpoints for Authentication and Registration

This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST

Tivix 2.4k Dec 29, 2022
Browsable web APIs for Flask.

Flask API Browsable web APIs for Flask. Status: This project is in maintenance mode. The original author (Tom Christie) has shifted his focus to API S

Flask API 1.3k Dec 27, 2022
Little Library API REST

Little Library API REST py 3.10 The only one requeriment it's to have Flask installed.

Luis Quiñones Requelme 1 Dec 15, 2021
Key-Value база данных на Tarantool и REST API к ней.

KVmail Key-Value база данных на Tarantool и REST API к ней. Документация к API доступна здесь. Requiremrnts ubuntu 16.04+ python3.6+ supervisord nginx

1 Jun 16, 2021
BreakFastApi 🍣 🍔 🍕 The most delicious API on the web

BreakFastApi 🍣 🍔 🍕 The most delicious API on the web. Just send a request and you'll receive the most mouth watering dish recipe with estimated coo

Mariia Sizova 156 Nov 19, 2022
A lightweight REST miniframework for Python.

restless A lightweight REST miniframework for Python. Documentation is at https://restless.readthedocs.io/. Works great with Django, Flask, Pyramid, T

Daniel Lindsley 824 Nov 20, 2022
Dropdown population implementation for Django REST Framework

drf-dropdown Dropdown population implementation for Django REST Framework Usage Add DropdownView to API URL # urls.py import dropdown urlpatterns = [

Preeti Yuankrathok 4 Dec 06, 2022
REST implementation of Django authentication system.

djoser REST implementation of Django authentication system. djoser library provides a set of Django Rest Framework views to handle basic actions such

Sunscrapers 2.2k Jan 01, 2023
Swagger Documentation Generator for Django REST Framework: deprecated

Django REST Swagger: deprecated (2019-06-04) This project is no longer being maintained. Please consider drf-yasg as an alternative/successor. I haven

Marc Gibbons 2.6k Dec 23, 2022
Built on Django Rest Framework, to provide with command execution on linux terminal

Built on Django Rest Framework, to provide with command execution on linux terminal

1 Oct 31, 2021
Country-specific Django helpers, to use in Django Rest Framework

django-rest-localflavor Country-specific serializers fields, to Django Rest Framework Documentation (soon) The full documentation is at https://django

Gilson Filho 19 Aug 30, 2022
A small repository of projects built in my course, REST APIs with Flask and Python.

A small repository of projects built in my course, REST APIs with Flask and Python.

Teclado 1k Jan 05, 2023
FastAPI framework, high performance, easy to learn, fast to code, ready for production

FastAPI framework, high performance, easy to learn, fast to code, ready for production Documentation: https://fastapi.tiangolo.com Source Code: https:

Sebastián Ramírez 53.1k Jan 06, 2023
Build a Backend REST API with Python & Django

Build a Backend REST API with Python & Django Skills Python Django djangorestframework Aws Git Use the below Git commands in the Windows Command Promp

JeonSoohyun a.k.a Edoc.. 1 Jan 25, 2022
Mlflow-rest-client - Python client for MLflow REST API

Python Client for MLflow Python client for MLflow REST API. Features: Minimal de

MTS 35 Dec 23, 2022
Creating delicious APIs for Django apps since 2010.

django-tastypie Creating delicious APIs for Django apps since 2010. Currently in beta but being used actively in production on several sites. Requirem

3.8k Dec 30, 2022