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
Embrace the APIs of the future. Hug aims to make developing APIs as simple as possible, but no simpler.

Read Latest Documentation - Browse GitHub Code Repository hug aims to make developing Python driven APIs as simple as possible, but no simpler. As a r

Hug API Framework 6.7k Dec 27, 2022
Flask RestAPI Project - Transimage Rest API For Python

[ 이미지 변환 플라스크 Rest API ver01 ] 0. Flask Rest API - in SunnyWeb : 이미지 변환 웹의 Flask

OliverKim 1 Jan 12, 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
simple api build with django rest framework

Django Rest API django-rest-framework Employees management simple API in this project wrote test suites for endpoints wrote simple doc string for clas

OMAR.A 1 Mar 31, 2022
Transparently use webpack with django

Looking for maintainers This repository is unmaintained as I don't have any free time to dedicate to this effort. If you or your organisation are heav

2.4k Dec 24, 2022
Extensions for Django REST Framework

Extensions for Django REST Framework

aiden 6 Dec 27, 2022
A minimalistic manga reader for desktop built with React and Django

smanga A minimalistic manga reader/server for serving local manga images on desktop browser. Provides a two-page view layout just as reading a physica

Padam Upreti 13 Sep 24, 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
BloodDonors: Built using Django REST Framework for the API backend and React for the frontend

BloodDonors By Daniel Yuan, Alex Tian, Aaron Pan, Jennifer Yuan As the pandemic raged, one of the side effects was an urgent shortage of blood donatio

Daniel Yuan 1 Oct 24, 2021
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
Web APIs for Django. 🎸

Django REST framework Awesome web-browsable Web APIs. Full documentation for the project is available at https://www.django-rest-framework.org/. Fundi

Encode 24.7k Jan 04, 2023
Django Ninja is a web framework for building APIs with Django and Python 3.6+ type hints.

💨 Fast, Async-ready, Openapi, type hints based framework for building APIs

Vitaliy Kucheryaviy 3.8k Jan 04, 2023
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
One package to access multiple different data sources through their respective API platforms.

BESTLab Platform One package to access multiple different data sources through their respective API platforms. Usage HOBO Platform See hobo_example.py

Wei 1 Nov 16, 2021
Automatically generate a RESTful API service for your legacy database. No code required!

sandman2 sandman2 documentation [ ~ Dependencies scanned by PyUp.io ~ ] sandman2 automagically generates a RESTful API service from your existing data

Jeff Knupp 1.9k Jan 07, 2023
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
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
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 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
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