Skip to content

2021 HeadStart SilliconValley Internship AI Project - Team A (Dayfly)

Notifications You must be signed in to change notification settings

Dayflt/WeirdMuseum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‘» Weird Museum πŸ‘» - Dayfly

License: CC BY-NC 4.0

Weird Museum is a responsive web where you can bring images to life. There is a couple of famous paintings you can choose and you can create realistic face swaps based on the target painting by just taking a short video clip.

✨ See our website! ✨

πŸ” User Interface

Main ➑️ Select ➑️ Record ➑️ Preview ➑️ Result ➑️ Gallery

πŸ’» System Architecture

Architecture_Final

πŸ’‘ Tech Stack

- Frontend : React
- API Server : Flask
- Deep learning : Pytorch, Colab
- Middleware : Gunicorn
- Web Server : Nginx
- Deployment: Docker, NHN Cloud, GCP(Cloud SQL, GCS bucket)
- Database: PostgreSQL
- API Test : Postman
- API Documentation : Swagger
- Version Control : Git, Github, GitKraken

➑️ Why do we choose these tech stacks for this project?

Frontend Backend etc
react Javascript Bootstrap axios Flask Python Gunicorn postgreSQL Pytorch Colab Docker Nginx githubVScode Google Cloud Platform GitKraken Swagger Postman Slack NHNcloud

βœ… Main POC

  • Create a face swap video
  • Save result video and share it at gallery page categorized by hashtag

πŸ‘€ Used Model

πŸ“— SWAGGER

✏️ Getting Started (Prerequisities & Installing & Running)

1. Cloning

$ git clone https://github.com/Dayflt/Silicon-Valley-Internship-Dayfly.git

2. Frontend: React βš›οΈ

  • Install packages
$ cd Frontend
$ npm i

3. Backend: Flask 🌢

  • Download vox-cpk.pth.tar here and add it inside Docker\Backend\web\AI\ directory after changing its name with mraa.tar

4. Docker 🐳

βœ” Development environment

$ docker-compose up --build         # build images and run containers
$ docker-compose down               # stop running containers
$ docker-compose up                 # rerun containers
or 
$ docker-compose down -v            # stop running containers and delete its volume
  • See database
$ docker-compose exec postgres_db psql --username=postgres --dbname=video
(psql)
video=# \l                            #list all databases
video=# \dt                           #list all tables in the current database
video=# select * from video_info;     #list all data of video_info table
  • Running
http://localhost:5000              # Flask application
http://localhost:5000/swagger      # Swagger
http://localhost:3000              # React application

βœ” Production environment

  1. Check whether 80 and 443 ports are open

  2. Modify configuration

  • Change domains and email addresses in init-letsencrypt.sh
  • Replace all occurrences of weirdmuseum.ml with your domain (ex: server_name museum.ml -> server_name 'your domain')
  1. Run the init script to obtain SSL Certificates and Credentials (./certbot directory will be created)
$ chmod +x ./init-letsencrypt.sh    # Make it executable
$ ./init-letsencrypt.sh             # Run the init script
  1. Check the status of your service
$ docker ps                       # See running containers
  1. Once you obtain SSL Certificates and Credentials, use the commands below to run, stop or rerun the containers.
 $ docker-compose -f docker-compose.prod.yml up --build
 $ docker-compose down                                         #stop running containers
 $ docker- compose -f docker-compose.prod.yml up               # rerun containers
 or
 $ docker-compose down                                         # stop running containers and delete its volume
  • Running (based on our domain)
https://museum.ml             # Nginx 

etc

$ docker ps                                       # See running containers
$ docker ps -a                                    # See all containers
$ docker-compose logs [service_name]              # Check the service logs
$ docker images                                   # See all built images
$ docker-compose rm -f $(docker ps -a -q)         # Remove all containers
$ docker volume ls                                # See volumes
$ docker images prune                             # Remove untagged(none) images
$ docker network prune                            # Remove all unused network
$ docker volume prune                             # Remove all unused local volume

πŸ”§ Directory Structure

β”œβ”€β”€ README.md                                          - λ¦¬λ“œλ―Έ 파일
β”‚
β”œβ”€β”€ Backend/                                           - λ°±μ—”λ“œ ν”ŒλΌμŠ€ν¬ 디렉토리
β”‚   β”œβ”€β”€ test_endpoints.py                              - unit test μ‹€ν–‰ 파일
β”‚   β”œβ”€β”€ run.py                                         - Flask μ‹€ν–‰ μœ„ν•œ 파일
β”‚   β”œβ”€β”€ views.py                                       - SQLAlchamy의 κΈ°λŠ₯을 μ •μ˜ν•œ 파일
β”‚   β”œβ”€β”€ .flaskenv                                      - Flask 싀행을 μœ„ν•œ ν™˜κ²½λ³€μˆ˜ μ„€μ • 파일
β”‚   β”œβ”€β”€ dayfly-318913-a4b443321e00.json                - Google Cloud Bucket에 μ ‘κ·Όν•˜κΈ° μœ„ν•œ κΆŒν•œ 정보가 λ‹΄κΈ΄ 파일        
β”‚   β”œβ”€β”€ requirements.txt                               - λͺ¨λ“ˆλ“€μ„ μ •λ¦¬ν•œ 파일
β”‚   └── web/
β”‚        β”œβ”€β”€ AI/                                       - AIλͺ¨λΈ μ•Œκ³ λ¦¬μ¦˜
β”‚        β”œβ”€β”€ data/result/                              - λ°±μ—”λ“œ λ™μ˜μƒ μž„μ‹œ μ €μž₯ 디렉토리
β”‚        β”œβ”€β”€ __init__.py                               - μ‹€ν–‰μ‹œν‚€λ €λŠ” flask app이 μ •μ˜λ˜μ–΄μžˆλŠ” 파일 ν”„λ‘œμ νŠΈλ₯Ό μ‹€ν–‰μ‹œν‚€λ©΄ app을 κ΅¬λ™μ‹œν‚΄
β”‚        β”œβ”€β”€ config.py                                 - ν•„μˆ˜ configuration 사항듀이 μ •μ˜λœ 파일
β”‚        β”œβ”€β”€ gcp.py                                    - google cloud bucket을 μ΄μš©ν•΄ 파일 μž…μΆœλ ₯ μŠ€νŠΈλ¦Όμ„ 닀루기 μœ„ν•œ ν•¨μˆ˜κ°€ μ •μ˜λœ 파일
β”‚        β”œβ”€β”€ models.py                                 - video_tableμ΄λΌλŠ” database classκ°€ μ •μ˜λœ 파일
β”‚        β”œβ”€β”€ prdedictmix.py                            - AI λͺ¨λΈμ„ μ μš©ν•΄μ„œ μ„œλΉ„μŠ€μ˜ 핡심인 μ„žμΈ μ˜μƒ 생성을 ν•˜κΈ° μœ„ν•œ 파일
β”‚        β”œβ”€β”€ routes.py                                 - API λͺ…μ„Έμ„œκ°€ λͺ¨λ‘ μ •μ˜λœ 파일
β”‚        β”œβ”€β”€ views.py                                  - database ORM μ •μ˜ 파일
β”‚              └── static/
β”‚              └── swagger.json                        - swagger μ •μ˜ 파일
β”‚
β”œβ”€β”€ Frontend/
β”‚   β”œβ”€β”€ Dockerfile                                    - ν”„λ‘ νŠΈμ•€λ“œ λ„μ»€νŒŒμΌ
β”‚   β”œβ”€β”€ public/
β”‚   β”‚    β”œβ”€β”€index.html                                - React ν”„λ‘œμ νŠΈ ν‘œμ‹œ(favicon, titleμ„€μ •)
β”‚   β”‚    └── logo.ico                                 - μ›ΉνŽ˜μ΄μ§€ favicon
β”‚   β”œβ”€β”€ package.json & package.lock.json              - 라이브러리 관리 파일
β”‚   └── src/ 
β”‚        β”œβ”€β”€ index.js & index.css                     - React ν”„λ‘œμ νŠΈ 파일
β”‚        β”œβ”€β”€ App.js & App.css                         - page componentλ“€ 관리 파일
β”‚        β”œβ”€β”€ App.test.js & setupTest.js
β”‚        β”œβ”€β”€ reportWebVitals.js
β”‚        β”œβ”€β”€ api.jsx                                  - baseURL μ„€μ •
β”‚        └── page/
β”‚   	        β”œβ”€β”€ css /                               - μ»΄ν¬λ„ŒνŠΈλ“€μ˜ css
β”‚   	        β”œβ”€β”€ imgs /                              - μ»΄ν¬λ„ŒνŠΈλ“€μ˜ image
β”‚   	        β”œβ”€β”€ Gallery.js                          - 가러리 νŽ˜μ΄μ§€
β”‚   	        β”œβ”€β”€ Home.js                             - 메인 νŽ˜μ΄μ§€
β”‚   	        β”œβ”€β”€ Preview.js                          - Preview νŽ˜μ΄μ§€
β”‚   	        β”œβ”€β”€ Record.js                           - μ›ΉμΊ  νŽ˜μ΄μ§€
β”‚   	        β”œβ”€β”€ Result.js                           - κ²°κ³Όλ¬Ό νŽ˜μ΄μ§€
β”‚   	        β”œβ”€β”€ Selection.js                        - 사진 선택 νŽ˜μ΄μ§€
β”‚   	        └── components/                        
β”‚                   └── Modal.js                      - 결과물의 정보 μž…λ ₯ νŒμ—…μ°½
β”‚
β”œβ”€β”€ Nginx/
β”‚   β”œβ”€β”€ Dockerfile                                    - nginx λ„μ»€νŒŒμΌ
β”‚   └── nginx.conf                                    - nginx μ„€μ •νŒŒμΌ
β”‚
β”œβ”€β”€ Settings/                                         -  ν™˜κ²½λ³€μˆ˜ μ„€μ • 파일
β”‚   β”œβ”€β”€ dev/                                              
β”‚   β”‚    └── .env.dev                                 -  κ°œλ°œν™˜κ²½λ³€μˆ˜ μ„€μ • 파일
β”‚   └── prod/
β”‚        └── .env.prod                                -  λ°°ν¬ν™˜κ²½λ³€μˆ˜ μ„€μ • 파일
β”œβ”€β”€ docker-compose.yml                                - 개발용 docker-compose파일
β”œβ”€β”€ docker-compose.prod.yml                           - 배포용 docker-compose파일
β”œβ”€β”€ init-letsencrypt.sh                               - SSLμΈμ¦μ„œ λ°œκΈ‰λ°›κΈ° μœ„ν•œ 과정을 μžλ™ν™”μ‹œν‚¨ 슀크립트파일 
└── .gitignore		

πŸ” Other repos

πŸ‘¨β€πŸ‘§β€πŸ‘¦ Contributors (2021/6/28 ~ 2021/07/30)

κΉ€μ„œμ—° 방근영 μ΄μ§€ν˜œ μž₯ν˜„μš° κΉ€ν•˜μ€
@ksy991018 @banggu0321 @penguin1109 @aswooo @harloxx
Project Manager,DevOps Front-end Developer AI, Back-end Developer Front-end Developer AI, Backend-Developer

About

2021 HeadStart SilliconValley Internship AI Project - Team A (Dayfly)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published