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
Introduction to Django Rest Framework

Introduction to Django Rest Framework This is the repository of the video series Introduction to Django Rest Framework published on YouTube. It is a s

Simple is Better Than Complex 20 Jul 14, 2022
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
A simple API example in Python (Flask framework)

API-Example A simple API in Python(Flask) ✨ Features An API i guess? 💁‍♀️ How to use first download the main.py install python then install flask fra

Portgas D Ace 2 Jan 06, 2022
REST API with Flask. No data persistence.

Flask REST API Python 3.9.7 The Flask experience, without data persistence :D First, to install all dependencies: python -m pip install -r requirement

Luis Quiñones Requelme 1 Dec 15, 2021
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
A light REST library for Django.

django-nap Read The Docs: https://django-nap.readthedocs.io/en/latest/ Change log: https://django-nap.readthedocs.io/en/latest/changelog.html An API l

Curtis Maloney 223 Dec 07, 2022
The no-nonsense, minimalist REST and app backend framework for Python developers, with a focus on reliability, correctness, and performance at scale.

The Falcon Web Framework Falcon is a reliable, high-performance Python web framework for building large-scale app backends and microservices. It encou

Falconry 9k Jan 03, 2023
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
Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.

drf-yasg - Yet another Swagger generator Generate real Swagger/OpenAPI 2.0 specifications from a Django Rest Framework API. Compatible with Django Res

Cristi Vîjdea 3k Jan 06, 2023
Eureka is a Rest-API framework scraper based on FastAPI for cleaning and organizing data, designed for the Eureka by Turing project of the National University of Colombia

Eureka is a Rest-API framework scraper based on FastAPI for cleaning and organizing data, designed for the Eureka by Turing project of the National University of Colombia

Julian Camilo Velandia 3 May 04, 2022
RESTful Todolist API

RESTful Todolist API GET todolist/ POST todolist/ {"desc" : "Description of task to do"} DELETE todolist/int:id PUT todolist/int:id Requirements D

Gabriel Tavares 5 Dec 20, 2021
Django queries

Djaq Djaq - pronounced “Jack” - provides an instant remote API to your Django models data with a powerful query language. No server-side code beyond t

Paul Wolf 53 Dec 12, 2022
REST API framework designed for human beings

Eve Eve is an open source Python REST API framework designed for human beings. It allows to effortlessly build and deploy highly customizable, fully f

eve 6.6k Jan 04, 2023
Eazytraining - Simple application to show how to query API from webapp

student-list Eazytraining - Simple application to show how to query API from webapp This repo is a simple application to list student with a webserver

⚡Christophe FREIJANES 2 Nov 15, 2021
The Web API toolkit. 🛠

🛠 The Web API toolkit. 🛠 Community: https://discuss.apistar.org 🤔 💭 🤓 💬 😎 Documentation: https://docs.apistar.com 📘 Requirements: Python 3.6+

Encode 5.6k Dec 27, 2022
A JSON Web Token authentication plugin for the Django REST Framework.

Simple JWT Abstract Simple JWT is a JSON Web Token authentication plugin for the Django REST Framework. For full documentation, visit django-rest-fram

Jazzband 3.3k Jan 04, 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
A RESTful whois

whois-rest A RESTful whois. Installation $ pip install poetry $ poetry install $ uvicorn app:app INFO: Started server process [64616] INFO: W

Manabu Niseki 4 Feb 19, 2022
Python bindings for Podman's RESTful API

podman-py This python package is a library of bindings to use the RESTful API of Podman. It is currently under development and contributors are welcom

Containers 142 Jan 06, 2023
A Django api to display items and their current up-to-date prices from different online retailers in one platform.

A Django api to display items and their current up-to-date prices from different online retailers in one platform. Utilizing scrapy to periodically scrape the latest prices from different online reta

Kennedy Ngugi Mwaura 1 Nov 05, 2021