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
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
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
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
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
Authentication Module for django rest auth

django-rest-knox Authentication Module for django rest auth Knox provides easy to use authentication for Django REST Framework The aim is to allow for

James McMahon 873 Dec 30, 2022
Integrate GraphQL into your Django project.

Graphene-Django A Django integration for Graphene. 💬 Join the community on Slack Documentation Visit the documentation to get started! Quickstart For

GraphQL Python 4k Dec 31, 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
Sanic-RESTPlus is an extension for Sanic that adds support for quickly building REST APIs.

Sanic RestPlus Sanic-RESTPlus is an extension for Sanic that adds support for quickly building REST APIs. Sanic-RESTPlus encourages best practices wit

Ashley Sommer 106 Oct 14, 2022
A small project in Python + Flask to demonstrate how to create a REST API

SmartBed-RESTApi-Example This application is an example of how to build a REST API. The application os a mock IoT device, simulating a Smart Bed. Impl

Rares Cristea 6 Jan 28, 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
Simplified REST API to get stickers from Snap

Snap Sticker kit REST API Simplified REST API to get stickers from Snap 💻 Instructions Search stickers Request: url = "https://sticker-kit-horizon733

Dishant Gandhi 1 Jan 05, 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
Flask RestAPI Project - Transimage Rest API For Python

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

OliverKim 1 Jan 12, 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
Recursive Serialization for Django REST framework

djangorestframework-recursive Overview Recursive Serialization for Django REST framework This package provides a RecursiveField that enables you to se

336 Dec 28, 2022
A Django-powered API with various utility apps / endpoints.

A Django-powered API Includes various utility apps / endpoints. Demos These web apps provide a frontend to the APIs in this project. Issue API Explore

Shemar Lindie 0 Sep 13, 2021
Restful API framework wrapped around MongoEngine

Flask-MongoRest A Restful API framework wrapped around MongoEngine. Setup from flask import Flask from flask_mongoengine import MongoEngine from flask

Close 525 Jan 01, 2023
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
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
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