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
Allows simplified Python interaction with Rapid7's InsightIDR REST API.

InsightIDR4Py Allows simplified Python interaction with Rapid7's InsightIDR REST API. InsightIDR4Py allows analysts to query log data from Rapid7 Insi

Micah Babinski 8 Sep 12, 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
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
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
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
Django app for handling the server headers required for Cross-Origin Resource Sharing (CORS)

django-cors-headers A Django App that adds Cross-Origin Resource Sharing (CORS) headers to responses. This allows in-browser requests to your Django a

Adam Johnson 4.8k Jan 05, 2023
RESTler is the first stateful REST API fuzzing tool for automatically testing cloud services through their REST APIs and finding security and reliability bugs in these services.

RESTler is the first stateful REST API fuzzing tool for automatically testing cloud services through their REST APIs and finding security and reliability bugs in these services.

Microsoft 1.8k Jan 04, 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
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
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
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
Scaffold django rest apis like a champion 🚀

scaffold django rest apis like a champion 🚀

Abdenasser Elidrissi 133 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
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
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
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 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
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
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