├── index.js
├── log
└── .gitkeep
├── scratch
├── planning
└── .gitkeep
├── results
└── .gitkeep
├── steps
└── .gitkeep
├── tests
└── .gitkeep
├── weights
└── .gitkeep
├── vc
├── service
│ ├── helper
│ │ ├── rife
│ │ │ ├── __init__.py
│ │ │ ├── requirements.txt
│ │ │ └── model
│ │ │ │ ├── warplayer.py
│ │ │ │ ├── laplacian.py
│ │ │ │ └── RIFE_HDv3.py
│ │ ├── inpainting
│ │ │ └── __init__.py
│ │ ├── abme
│ │ │ ├── correlation_package
│ │ │ │ ├── __init__.py
│ │ │ │ ├── pyproject.toml
│ │ │ │ ├── setup.py
│ │ │ │ ├── nvcc setting.md
│ │ │ │ ├── correlation_cuda_kernel.cuh
│ │ │ │ └── correlation.py
│ │ │ ├── model
│ │ │ │ └── __init__.py
│ │ │ ├── Upsample.py
│ │ │ └── utils.py
│ │ ├── midas
│ │ │ ├── __init__.py
│ │ │ └── midas
│ │ │ │ ├── base_model.py
│ │ │ │ └── midas_net.py
│ │ ├── __init__.py
│ │ ├── esrgan
│ │ │ ├── __init__.py
│ │ │ ├── train.py
│ │ │ ├── archs
│ │ │ │ ├── __init__.py
│ │ │ │ └── discriminator_arch.py
│ │ │ ├── models
│ │ │ │ └── __init__.py
│ │ │ └── data
│ │ │ │ └── __init__.py
│ │ ├── string.py
│ │ ├── hash.py
│ │ ├── dimensions.py
│ │ ├── tier.py
│ │ └── vqgan.py
│ ├── provider
│ │ ├── __init__.py
│ │ └── api.py
│ ├── __init__.py
│ ├── job.py
│ ├── isr.py
│ └── file.py
├── q.py
├── r.py
├── app.py
├── event_listener
│ ├── __init__.py
│ ├── base.py
│ └── generation_request.py
├── db.py
├── injector.py
├── migrate.py
├── model
│ ├── __init__.py
│ ├── base.py
│ ├── user.py
│ ├── generation_result.py
│ └── generation_request.py
├── job
│ ├── __init__.py
│ └── base.py
├── auth.py
├── value_object
│ ├── __init__.py
│ ├── generation_progress.py
│ └── generation_spec.py
├── main.py
├── uwsgi.ini
├── exception
│ ├── third_party_exception.py
│ ├── __init__.py
│ ├── not_authenticated_exception.py
│ ├── not_found_exception.py
│ ├── tier_exception.py
│ └── vc_exception.py
├── restore.py
├── manager
│ ├── __init__.py
│ ├── generation_result.py
│ ├── user.py
│ └── base.py
├── event
│ ├── __init__.py
│ ├── base.py
│ └── generation_request.py
├── command
│ ├── base.py
│ ├── __init__.py
│ ├── trigger.py
│ ├── video.py
│ ├── esrgan.py
│ ├── abme.py
│ ├── rife.py
│ ├── inpainting.py
│ ├── vqgan_clip.py
│ ├── abme_steps.py
│ └── rife_steps.py
├── controller
│ ├── __init__.py
│ └── base.py
├── hash.py
├── worker.py
├── cli.py
├── __init__.py
├── services.py
├── api.py
└── validator
│ └── generation_request.py
├── styles.txt
├── redis.conf.example
├── scss.sh
├── migrations
├── README
├── script.py.mako
└── alembic.ini
├── app
├── assets
│ ├── help.png
│ ├── icon.png
│ ├── logo.png
│ ├── tezos.png
│ ├── colours.png
│ ├── github.png
│ ├── logo-sm.png
│ ├── patreon.png
│ ├── twitter.png
│ ├── add-image.png
│ ├── add-video.png
│ ├── news
│ │ ├── foss.png
│ │ ├── index.png
│ │ └── ajmoon.png
│ ├── placeholder.png
│ ├── watermark-1280.png
│ ├── watermark-400.png
│ ├── watermark-533.png
│ └── watermark-800.png
├── ts
│ ├── models
│ │ ├── base-model.ts
│ │ ├── video-spec.ts
│ │ ├── user.ts
│ │ ├── generation-result.ts
│ │ ├── generation-spec.ts
│ │ ├── image-spec.ts
│ │ └── generation-request.ts
│ ├── elements
│ │ ├── info.inc
│ │ ├── login.ts
│ │ ├── info.ts
│ │ ├── generation-request-form
│ │ │ ├── add-video-step.ts
│ │ │ ├── add-spec.ts
│ │ │ ├── image-spec-option.ts
│ │ │ └── video-spec-form.ts
│ │ ├── generation-requests.ts
│ │ ├── chip.ts
│ │ ├── base-element.ts
│ │ ├── login-form.ts
│ │ ├── chipset.ts
│ │ ├── generation-request.ts
│ │ ├── news
│ │ │ └── nav.ts
│ │ └── generation-request
│ │ │ └── step.ts
│ ├── helpers
│ │ ├── env.ts
│ │ ├── notification.ts
│ │ ├── auth.ts
│ │ └── status.ts
│ ├── managers
│ │ ├── user-manager.ts
│ │ ├── generation-request-manager.ts
│ │ └── base-manager.ts
│ └── elements.ts
├── scss
│ ├── _config.scss
│ ├── _generation_requests.scss
│ ├── _login_form.scss
│ ├── chipset.scss
│ ├── _generation_request.scss
│ ├── chip.scss
│ ├── _container.scss
│ ├── _news.scss
│ ├── vc.scss
│ ├── generation_request_form
│ │ ├── _video_spec_form.scss
│ │ ├── _add_spec.scss
│ │ ├── _add_video_step.scss
│ │ ├── _image_spec_option.scss
│ │ └── _image_spec_form.scss
│ ├── vc.css.map
│ ├── _normalize.scss
│ ├── _header.scss
│ ├── _info.scss
│ ├── _theme.scss
│ ├── _footer.scss
│ ├── generation_request
│ │ ├── _step.scss
│ │ └── _details.scss
│ ├── _generation_request_form.scss
│ └── news
│ │ └── _text.scss
├── index.html
└── partials
│ ├── footer.html
│ └── header.html
├── public
└── favicon.ico
├── s.sh
├── scripts
├── frontend.sh
├── migrate.sh
├── db.sh
├── aws.start.sh
├── aws.stop.sh
├── backend.sh
├── public.sh
├── dump.sh
├── build.sh
├── restore.sh
├── sh.sh
└── run.sh
├── docker.flask.sh
├── restore.sh
├── docker
├── redis
│ └── Dockerfile
├── nginx
│ ├── Dockerfile
│ ├── ssl
│ │ ├── vc.local.crt
│ │ └── vc.local.key
│ └── conf
│ │ └── flask.conf
└── flask
│ └── Dockerfile
├── local-wrapper.sh
├── update.sh
├── .dockerignore
├── zoom3d.py
├── restart.sh
├── dump.sh
├── image-high.sh
├── supervisor.api.conf
├── supervisor.worker.conf
├── sofar.sh
├── video.sh
├── video-high.sh
├── docker.worker.sh
├── zoom.sh
├── image.sh
├── index.sh
├── .bashrc
├── latest.py
├── requirements.worker.txt
├── .env.example
├── .gitignore
├── nginx.unsecure.conf
├── diagnosis.sh
├── LICENSE
├── vqgan
├── LICENSE
├── zoom.sh
├── random.sh
├── video_styler.sh
├── opt_tester.sh
└── vqgan.yml
├── debug.html
├── argument.yml
├── package.json
├── Taskfile.yml
├── requirements.api.txt
├── tests.sh
├── docker-compose.yml
├── planning.py
├── isr.py
└── nginx.conf
/index.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/log/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/scratch:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/planning/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/results/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/steps/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/weights/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vc/service/helper/rife/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vc/service/helper/inpainting/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/styles.txt:
--------------------------------------------------------------------------------
1 | high resolution
2 | upscale
3 |
4 |
--------------------------------------------------------------------------------
/redis.conf.example:
--------------------------------------------------------------------------------
1 | requirepass password-goes-here
2 |
--------------------------------------------------------------------------------
/scss.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | npm run scss
4 |
5 |
--------------------------------------------------------------------------------
/vc/q.py:
--------------------------------------------------------------------------------
1 | from flask_rq import RQ
2 |
3 | q = RQ()
4 |
--------------------------------------------------------------------------------
/vc/r.py:
--------------------------------------------------------------------------------
1 | from redis import Redis
2 |
3 | r = Redis()
4 |
--------------------------------------------------------------------------------
/migrations/README:
--------------------------------------------------------------------------------
1 | Single-database configuration for Flask.
2 |
--------------------------------------------------------------------------------
/vc/service/helper/abme/correlation_package/__init__.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/vc/app.py:
--------------------------------------------------------------------------------
1 | from vc import create_app
2 |
3 | app = create_app()
4 |
--------------------------------------------------------------------------------
/vc/event_listener/__init__.py:
--------------------------------------------------------------------------------
1 | from .base import VcEventListener
2 |
--------------------------------------------------------------------------------
/vc/service/helper/midas/__init__.py:
--------------------------------------------------------------------------------
1 | from .run import run_depth
2 |
--------------------------------------------------------------------------------
/vc/service/provider/__init__.py:
--------------------------------------------------------------------------------
1 | from .api import ApiProvider
2 |
--------------------------------------------------------------------------------
/vc/service/helper/__init__.py:
--------------------------------------------------------------------------------
1 | from .diagnosis import DiagnosisHelper
2 |
--------------------------------------------------------------------------------
/vc/db.py:
--------------------------------------------------------------------------------
1 | from flask_sqlalchemy import SQLAlchemy
2 |
3 | db = SQLAlchemy()
4 |
--------------------------------------------------------------------------------
/vc/injector.py:
--------------------------------------------------------------------------------
1 | from injector import Injector
2 |
3 | injector = Injector()
4 |
--------------------------------------------------------------------------------
/vc/migrate.py:
--------------------------------------------------------------------------------
1 | from flask_migrate import Migrate
2 |
3 | migrate = Migrate()
4 |
--------------------------------------------------------------------------------
/vc/model/__init__.py:
--------------------------------------------------------------------------------
1 | # DO NOT IMPORT MODELS HERE! IT CREATES A CIRCULAR IMPORT!
2 |
--------------------------------------------------------------------------------
/app/assets/help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/help.png
--------------------------------------------------------------------------------
/app/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/icon.png
--------------------------------------------------------------------------------
/app/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/logo.png
--------------------------------------------------------------------------------
/app/assets/tezos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/tezos.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/vc/job/__init__.py:
--------------------------------------------------------------------------------
1 | from .base import Job
2 | from .generation import GenerationJob
3 |
--------------------------------------------------------------------------------
/app/assets/colours.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/colours.png
--------------------------------------------------------------------------------
/app/assets/github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/github.png
--------------------------------------------------------------------------------
/app/assets/logo-sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/logo-sm.png
--------------------------------------------------------------------------------
/app/assets/patreon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/patreon.png
--------------------------------------------------------------------------------
/app/assets/twitter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/twitter.png
--------------------------------------------------------------------------------
/s.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | sudo supervisorctl -c /etc/supervisor/supervisord.conf $@
4 |
5 |
--------------------------------------------------------------------------------
/app/assets/add-image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/add-image.png
--------------------------------------------------------------------------------
/app/assets/add-video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/add-video.png
--------------------------------------------------------------------------------
/app/assets/news/foss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/news/foss.png
--------------------------------------------------------------------------------
/app/assets/news/index.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/news/index.png
--------------------------------------------------------------------------------
/scripts/frontend.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | npm install
4 | npx webpack build --node-env=private
5 |
--------------------------------------------------------------------------------
/app/assets/news/ajmoon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/news/ajmoon.png
--------------------------------------------------------------------------------
/app/assets/placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/placeholder.png
--------------------------------------------------------------------------------
/vc/auth.py:
--------------------------------------------------------------------------------
1 | from flask_httpauth import HTTPTokenAuth
2 |
3 | auth = HTTPTokenAuth(scheme='Bearer')
4 |
--------------------------------------------------------------------------------
/app/assets/watermark-1280.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/watermark-1280.png
--------------------------------------------------------------------------------
/app/assets/watermark-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/watermark-400.png
--------------------------------------------------------------------------------
/app/assets/watermark-533.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/watermark-533.png
--------------------------------------------------------------------------------
/app/assets/watermark-800.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alex-moon/vc/HEAD/app/assets/watermark-800.png
--------------------------------------------------------------------------------
/vc/event_listener/base.py:
--------------------------------------------------------------------------------
1 | class VcEventListener:
2 | def on(self, *args, **kwargs):
3 | pass
4 |
--------------------------------------------------------------------------------
/vc/value_object/__init__.py:
--------------------------------------------------------------------------------
1 | from .generation_spec import GenerationSpec, ImageSpec, VideoSpec, VideoStepSpec
2 |
--------------------------------------------------------------------------------
/vc/main.py:
--------------------------------------------------------------------------------
1 | from vc import create_app
2 |
3 | if __name__ == '__main__':
4 | create_app().run(host='0.0.0.0')
5 |
--------------------------------------------------------------------------------
/docker.flask.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | python3 -m venv venv
4 | source venv/bin/activate
5 | uwsgi --ini vc/uwsgi.ini
6 |
--------------------------------------------------------------------------------
/vc/uwsgi.ini:
--------------------------------------------------------------------------------
1 | [uwsgi]
2 | module = vc:create_app()
3 |
4 | master = true
5 | processes = 1
6 |
7 | http = 0.0.0.0:5000
8 |
--------------------------------------------------------------------------------
/app/ts/models/base-model.ts:
--------------------------------------------------------------------------------
1 | export class BaseModel {
2 | id ?: number;
3 | created ?: string;
4 | updated ?: string;
5 | }
6 |
--------------------------------------------------------------------------------
/scripts/migrate.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source venv/bin/activate
4 | export FLASK_APP=vc.app:app
5 | flask db migrate
6 | flask db upgrade
7 |
--------------------------------------------------------------------------------
/app/ts/models/video-spec.ts:
--------------------------------------------------------------------------------
1 | import {VideoStepSpec} from "./image-spec";
2 |
3 | export class VideoSpec {
4 | steps: VideoStepSpec[];
5 | }
6 |
--------------------------------------------------------------------------------
/vc/exception/third_party_exception.py:
--------------------------------------------------------------------------------
1 | from .vc_exception import VcException
2 |
3 |
4 | class ThirdPartyException(VcException):
5 | pass
6 |
--------------------------------------------------------------------------------
/vc/service/__init__.py:
--------------------------------------------------------------------------------
1 | from .job import JobService
2 | from .provider.api import ApiProvider
3 | from .queue import QueueService, JobSerializer
4 |
--------------------------------------------------------------------------------
/vc/service/helper/abme/model/__init__.py:
--------------------------------------------------------------------------------
1 | from .SBMNet import SBMENet
2 | from .ABMNet import ABMRNet
3 | from .SynthesisNet import SynthesisNet
4 |
--------------------------------------------------------------------------------
/restore.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source venv/bin/activate
4 | sudo service supervisor stop
5 | python3 -m vc.restore
6 | sudo service supervisor start
7 |
--------------------------------------------------------------------------------
/app/scss/_config.scss:
--------------------------------------------------------------------------------
1 | $mobile-width: 600px;
2 |
3 | @mixin mobile {
4 | @media (max-width: #{$mobile-width - 1px}) {
5 | @content;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/docker/redis/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM redis:6.2.4
2 | COPY redis.conf /usr/local/etc/redis/redis.conf
3 | CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
4 |
--------------------------------------------------------------------------------
/vc/service/helper/esrgan/__init__.py:
--------------------------------------------------------------------------------
1 | # flake8: noqa
2 | from .archs import *
3 | from .data import *
4 | from .models import *
5 | from .utils import *
6 |
--------------------------------------------------------------------------------
/vc/restore.py:
--------------------------------------------------------------------------------
1 | from vc import create_app
2 | from vc.db import db
3 |
4 | if __name__ == '__main__':
5 | create_app()
6 | db.drop_all()
7 | db.create_all()
8 |
--------------------------------------------------------------------------------
/vc/job/base.py:
--------------------------------------------------------------------------------
1 | class Job:
2 | # @todo could define id/key? coule define args? latter would be useful!
3 |
4 | def handle(self, *args, **kwargs):
5 | pass
6 |
--------------------------------------------------------------------------------
/vc/manager/__init__.py:
--------------------------------------------------------------------------------
1 | from .generation_request import GenerationRequestManager
2 | from .generation_result import GenerationResultManager
3 | from .user import UserManager
4 |
--------------------------------------------------------------------------------
/vc/service/helper/rife/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy>=1.16
2 | tqdm>=4.35.0
3 | sk-video>=1.1.10
4 | torch==1.6.0
5 | opencv-python>=4.1.2
6 | moviepy>=1.0.3
7 | torchvision==0.7.0
8 |
--------------------------------------------------------------------------------
/scripts/db.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source /opt/vc/.env
4 |
5 | echo "Connecting to $DB_HOST"
6 |
7 | PGPASSWORD=$DB_PASS psql --user=$DB_USER --host=$DB_HOST --port=$DB_PORT $DB_NAME
8 |
--------------------------------------------------------------------------------
/app/scss/_generation_requests.scss:
--------------------------------------------------------------------------------
1 | vc-generation-requests {
2 | flex-grow: 1;
3 | background-color: #63575b;
4 | overflow: auto;
5 |
6 | @import "generation_request";
7 | }
8 |
--------------------------------------------------------------------------------
/app/ts/models/user.ts:
--------------------------------------------------------------------------------
1 | import {BaseModel} from "./base-model";
2 |
3 | export class User extends BaseModel {
4 | name ?: string;
5 | email ?: string;
6 | tier ?: number;
7 | }
8 |
--------------------------------------------------------------------------------
/local-wrapper.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | python3 -m venv venv
4 | source venv/bin/activate
5 | export FLASK_ENV=development
6 | export FLASK_APP="vc:create_app()"
7 | flask run --host=0.0.0.0
8 |
--------------------------------------------------------------------------------
/vc/event/__init__.py:
--------------------------------------------------------------------------------
1 | from .base import VcEvent, VcEventDispatcher
2 | from .generation_request import (
3 | GenerationRequestCreatedEvent,
4 | GenerationRequestCancelledEvent,
5 | )
6 |
--------------------------------------------------------------------------------
/app/ts/models/generation-result.ts:
--------------------------------------------------------------------------------
1 | import {BaseModel} from "./base-model";
2 |
3 | export class GenerationResult extends BaseModel {
4 | url: string;
5 | url_watermarked: string;
6 | }
7 |
--------------------------------------------------------------------------------
/update.sh:
--------------------------------------------------------------------------------
1 | ffmpeg -y -i input/input-%04d.png -b:v 8M -c:v h264_nvenc -pix_fmt yuv420p -strict -2 -filter:v minterpolate=mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=60 results/video-sixth-attempt.mp4
2 |
--------------------------------------------------------------------------------
/app/ts/elements/info.inc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
Help text would go here
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/vc/command/base.py:
--------------------------------------------------------------------------------
1 | class BaseCommand:
2 | description: str
3 | args = []
4 |
5 | def run(self, args):
6 | self.handle(args)
7 |
8 | def handle(self, args):
9 | pass
10 |
--------------------------------------------------------------------------------
/vc/controller/__init__.py:
--------------------------------------------------------------------------------
1 | from .generation_request import *
2 | from .user import *
3 |
4 |
5 | def init_app(app):
6 | # DO NOT REMOVE THIS! THIS FILE MUST BE IMPORTED FOR CONTROLLERS TO WORK
7 | pass
8 |
--------------------------------------------------------------------------------
/app/ts/models/generation-spec.ts:
--------------------------------------------------------------------------------
1 | import {VideoSpec} from "./video-spec";
2 | import {ImageSpec} from "./image-spec";
3 |
4 | export class GenerationSpec {
5 | images: ImageSpec[];
6 | videos: VideoSpec[];
7 | }
8 |
--------------------------------------------------------------------------------
/vc/service/helper/abme/correlation_package/pyproject.toml:
--------------------------------------------------------------------------------
1 | [build-system]
2 | # Minimum requirements for the build system to execute.
3 | requires = ["setuptools", "wheel", "numpy", "torch"] # PEP 508 specifications.
4 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | venv
2 | venv.mac
3 | node_modules
4 | log
5 | results
6 | mesh
7 | depth
8 | checkpoints
9 | taming-transformers
10 | samples
11 | .git
12 | BoostingMonocularDepth
13 | CLIP
14 | MiDaS
15 | pgsql
16 |
--------------------------------------------------------------------------------
/scripts/aws.start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | id=$(aws ec2 describe-instances | jq -r '.[][].Instances[] | select(.Tags[].Key=="Name" and .Tags[].Value=="vc") | .InstanceId')
4 | aws ec2 start-instances --instance-ids $id
5 |
6 |
--------------------------------------------------------------------------------
/scripts/aws.stop.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | id=$(aws ec2 describe-instances | jq -r '.[][].Instances[] | select(.Tags[].Key=="Name" and .Tags[].Value=="vc") | .InstanceId')
4 | aws ec2 stop-instances --instance-ids $id
5 |
6 |
--------------------------------------------------------------------------------
/vc/manager/generation_result.py:
--------------------------------------------------------------------------------
1 | from vc.manager.base import Manager
2 | from vc.model.generation_result import GenerationResult
3 |
4 |
5 | class GenerationResultManager(Manager):
6 | model_class = GenerationResult
7 |
--------------------------------------------------------------------------------
/app/scss/_login_form.scss:
--------------------------------------------------------------------------------
1 | vc-login-form {
2 | background-color: #d7e6d6;
3 |
4 | vc-login {
5 | display: block;
6 | padding: 16px;
7 | }
8 |
9 | @import "generation_request_form";
10 | }
11 |
--------------------------------------------------------------------------------
/scripts/backend.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | docker exec -it $(docker ps | grep vc_flask | awk '{ print $1 }') bash -c "
4 | source venv/bin/activate
5 |
6 | pip3 install -r requirements.api.txt
7 |
8 | scripts/migrate.sh
9 | "
10 |
--------------------------------------------------------------------------------
/app/scss/chipset.scss:
--------------------------------------------------------------------------------
1 | vc-chipset {
2 | display: block;
3 |
4 | .chipset {
5 | display: flex;
6 | flex-wrap: wrap;
7 | justify-content: flex-start;
8 |
9 | @import "chip";
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/app/ts/helpers/env.ts:
--------------------------------------------------------------------------------
1 | export class EnvHelper {
2 | static get useLocal(): boolean {
3 | return (window as any).env.useLocal;
4 | }
5 | static get host(): string {
6 | return (window as any).env.host;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/vc/exception/__init__.py:
--------------------------------------------------------------------------------
1 | from .not_found_exception import NotFoundException
2 | from .not_authenticated_exception import NotAuthenticatedException
3 | from .vc_exception import VcException
4 | from .third_party_exception import ThirdPartyException
5 |
--------------------------------------------------------------------------------
/vc/hash.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from vc.service.helper.hash import HashHelper
3 |
4 | if len(sys.argv) < 2:
5 | print('Usage: %s ' % sys.argv[0])
6 | print()
7 | exit(9)
8 |
9 | print(HashHelper.get(sys.argv[1]))
10 | print()
11 |
--------------------------------------------------------------------------------
/zoom3d.py:
--------------------------------------------------------------------------------
1 | import yaml
2 |
3 | from vc.service.inpainting import InpaintingService, InpaintingOptions
4 |
5 | config = yaml.load(open('argument.yml', 'r'))
6 | args = InpaintingOptions(**config)
7 | service = InpaintingService()
8 | service.handle(args)
9 |
--------------------------------------------------------------------------------
/restart.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | git pull origin $(git rev-parse --abbrev-ref HEAD)
4 | if [[ ! -z "$1" ]]; then
5 | ./restore.sh
6 | else
7 | sudo service supervisor restart
8 | fi
9 | npx webpack
10 | tail -f /var/log/supervisor/* /opt/vc/log/*
11 |
--------------------------------------------------------------------------------
/dump.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | touch backup.sql
4 | mv backup.sql backup.sql.bak
5 | pass=$(cat .env | grep SQLALCHEMY_DATABASE_URI | awk -F':' '{ print $3 }' | awk -F'@' '{ print $1 }')
6 | PGPASSWORD=$pass pg_dump --user=vc --host=127.0.0.1 vc "$@" > backup.sql
7 |
8 |
--------------------------------------------------------------------------------
/vc/exception/not_authenticated_exception.py:
--------------------------------------------------------------------------------
1 | from .vc_exception import VcException
2 |
3 |
4 | class NotAuthenticatedException(VcException):
5 | code = 403
6 |
7 | def __init__(self, token: str):
8 | super().__init__("Invalid token: [%s]" % token)
9 |
--------------------------------------------------------------------------------
/docker/nginx/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nginx:latest
2 |
3 | RUN apt-get -y update
4 | RUN apt-get -y install vim less curl gnupg apt-transport-https
5 |
6 | COPY docker/nginx/conf/flask.conf /etc/nginx/nginx.conf
7 |
8 | EXPOSE 80
9 | EXPOSE 443
10 |
11 | WORKDIR /etc/nginx
12 |
--------------------------------------------------------------------------------
/scripts/public.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | npm install
4 | npx webpack build --node-env=public
5 | ssh vos "
6 | cp /opt/vc/public/assets/latest.json /opt/vc/latest.bak
7 | "
8 | rsync -av --delete public/ vos:/opt/vc/public/
9 | ssh vos "
10 | cd /opt/vc/
11 | python3 latest.py
12 | "
13 |
--------------------------------------------------------------------------------
/vc/exception/not_found_exception.py:
--------------------------------------------------------------------------------
1 | from .vc_exception import VcException
2 |
3 |
4 | class NotFoundException(VcException):
5 | code = 404
6 |
7 | def __init__(self, model_class: str, id_: int):
8 | super().__init__("Model not found: [%s] for id [%s]" % (model_class, id_))
9 |
--------------------------------------------------------------------------------
/scripts/dump.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source /opt/vc/.env
4 |
5 | echo "Taking dump from $DB_HOST - hit any key to continue, or CTRL+C to cancel"
6 | read
7 |
8 | mv backup.sql backup.sql.bak
9 |
10 | PGPASSWORD=$DB_PASS pg_dump --user=$DB_USER --host=$DB_HOST --port=$DB_PORT $DB_NAME > backup.sql
11 |
--------------------------------------------------------------------------------
/vc/worker.py:
--------------------------------------------------------------------------------
1 | from vc.service.queue import QueueService
2 |
3 | from . import create_app
4 | from .injector import injector
5 | from .job import *
6 |
7 | if __name__ == '__main__':
8 | app = create_app()
9 | queue_service = injector.get(QueueService)
10 | queue_service.get_worker().work()
11 |
--------------------------------------------------------------------------------
/image-high.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [[ -z "$@" ]]; then
4 | echo "Usage: $0 "
5 | exit
6 | fi
7 |
8 | source venv/bin/activate
9 | python3 generate.py -p "$@" -s 720 720
10 | slug=$(echo "$@" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9][^a-z0-9]*/-/g')
11 | mv output.png results/$slug.png
12 |
13 |
--------------------------------------------------------------------------------
/supervisor.api.conf:
--------------------------------------------------------------------------------
1 | [program:uwsgi]
2 | user=ubuntu
3 | directory=/opt/vc
4 | command=/opt/vc/venv/bin/uwsgi --ini /opt/vc/vc/uwsgi.ini
5 | autostart=true
6 | autorestart=true
7 | stderr_logfile=/var/log/supervisor/vc.error.log
8 | stdout_logfile=/var/log/supervisor/vc.log
9 | stopsignal=INT
10 | environment=SERVICE=uwsgi
11 |
--------------------------------------------------------------------------------
/vc/command/__init__.py:
--------------------------------------------------------------------------------
1 | from .base import BaseCommand
2 | from .inpainting import InpaintingCommand
3 | from .vqgan_clip import VqganClipCommand
4 | from .esrgan import EsrganCommand
5 | from .rife import RifeCommand
6 | from .rife_steps import RifeStepsCommand
7 | from .video import VideoCommand
8 | from .trigger import TriggerCommand
9 |
--------------------------------------------------------------------------------
/app/index.html:
--------------------------------------------------------------------------------
1 | <%= require('./partials/header.html?raw') %>
2 |
9 | <%= require('./partials/footer.html?raw') %>
10 |
--------------------------------------------------------------------------------
/supervisor.worker.conf:
--------------------------------------------------------------------------------
1 | [program:worker]
2 | user=ubuntu
3 | directory=/opt/vc
4 | command=/opt/vc/venv/bin/python3 -m vc.worker
5 | autostart=true
6 | autorestart=true
7 | stderr_logfile=/var/log/supervisor/vc.worker.error.log
8 | stdout_logfile=/var/log/supervisor/vc.worker.log
9 | stopsignal=INT
10 | environment=SERVICE=worker
11 |
--------------------------------------------------------------------------------
/sofar.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ffmpeg -y -i "steps/%04d.png" \
4 | -b:v 8M -c:v h264_nvenc -pix_fmt yuv420p -strict -2 \
5 | -filter:v "minterpolate='mi_mode=mci:mc_mode=aobmc:me_mode=bidir:vsbmc=1:fps=60'" \
6 | sofar.mp4
7 |
8 | ffmpeg -i sofar.mp4 -i app/assets/watermark.png -filter_complex "overlay=0:0" \
9 | sofar-watermarked.mp4
10 |
--------------------------------------------------------------------------------
/video.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [[ -z "$@" ]]; then
4 | echo "Usage: $0 "
5 | exit
6 | fi
7 |
8 | source venv/bin/activate
9 | python3 generate.py -p "$@" -s 400 400 --video
10 | slug=$(echo "$@" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9][^a-z0-9]*/-/g')
11 | mv output.mp4 results/$slug.mp4
12 | mv steps/500.png results/$slug.png
13 |
14 |
--------------------------------------------------------------------------------
/video-high.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [[ -z "$@" ]]; then
4 | echo "Usage: $0 "
5 | exit
6 | fi
7 |
8 | source venv/bin/activate
9 | python3 generate.py -p "$@" -s 720 720 --video
10 | slug=$(echo "$@" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9][^a-z0-9]*/-/g')
11 | mv output.mp4 results/$slug.mp4
12 | mv steps/500.png results/$slug.png
13 |
14 |
--------------------------------------------------------------------------------
/docker.worker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [[ -z "$(grep 'ROLE.*worker' .env)" ]]; then
4 | echo "Role is not worker, so not starting worker."
5 | sleep 999999999
6 | exit
7 | fi
8 |
9 | Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &
10 | export DISPLAY=:0
11 |
12 | python3 -m venv venv
13 | source venv/bin/activate
14 | python3 -m vc.worker
15 |
--------------------------------------------------------------------------------
/vc/exception/tier_exception.py:
--------------------------------------------------------------------------------
1 | from .vc_exception import VcException
2 |
3 |
4 | class TierException(VcException):
5 | code = 403
6 |
7 | def __init__(self, tier: str, info: str = None):
8 | message = "Minimum tier required: [%s]" % tier
9 | if info is not None:
10 | message += ': %s' % info
11 | super().__init__(message)
12 |
--------------------------------------------------------------------------------
/vc/value_object/generation_progress.py:
--------------------------------------------------------------------------------
1 | from dataclasses import dataclass
2 |
3 |
4 | @dataclass
5 | class GenerationProgress:
6 | steps_total: int
7 | steps_completed: int
8 | name: str
9 | preview: str = None
10 | result: str = None
11 | result_watermarked: str = None
12 | interim: str = None
13 | interim_watermarked: str = None
14 |
15 |
--------------------------------------------------------------------------------
/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | red="$(tput setaf 1)"
4 | green="$(tput setaf 2)"
5 | yellow="$(tput setaf 3)"
6 | reset="$(tput sgr0)"
7 | function red() { echo "${red}${@}${reset}"; }
8 | function green() { echo "${green}${@}${reset}"; }
9 | function yellow() { echo "${yellow}${@}${reset}"; }
10 |
11 | green "Building images"
12 | docker-compose build
13 |
14 | green Done
15 |
--------------------------------------------------------------------------------
/vc/service/helper/esrgan/train.py:
--------------------------------------------------------------------------------
1 | # flake8: noqa
2 | import os.path as osp
3 | from basicsr.train import train_pipeline
4 |
5 | import vc.service.helper.esrgan.archs
6 | import vc.service.helper.esrgan.data
7 | import vc.service.helper.esrgan.models
8 |
9 | if __name__ == '__main__':
10 | root_path = osp.abspath(osp.join(__file__, osp.pardir, osp.pardir))
11 | train_pipeline(root_path)
12 |
--------------------------------------------------------------------------------
/app/scss/_generation_request.scss:
--------------------------------------------------------------------------------
1 | vc-generation-request {
2 | display: block;
3 | margin: $border-width $border-width 0;
4 | border-radius: $border-radius;
5 | box-sizing: border-box;
6 |
7 | .request {
8 | display: flex;
9 | flex-direction: column;
10 |
11 | @import "generation_request/summary";
12 | @import "generation_request/details";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/zoom.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [[ -z "$@" ]]; then
4 | echo "Usage: $0 "
5 | exit
6 | fi
7 |
8 | source venv/bin/activate
9 | slug=$(echo "$@" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9][^a-z0-9]*/-/g')
10 |
11 | if [[ -f "results/$slug.png" ]]; then
12 | echo "results/$slug.png exists - skipping"
13 | exit
14 | fi
15 |
16 | python3 generate.py -p "$@" -s 400 400
17 | mv output.png results/$slug.png
18 |
--------------------------------------------------------------------------------
/vc/service/helper/string.py:
--------------------------------------------------------------------------------
1 | from datetime import timedelta
2 |
3 |
4 | class StringHelper:
5 | @classmethod
6 | def timedelta(cls, d: timedelta):
7 | s = d.seconds
8 | hours, remainder = divmod(s, 3600)
9 | minutes, seconds = divmod(remainder, 60)
10 | return '{hours}h {minutes}m {seconds}s'.format(
11 | hours=hours,
12 | minutes=minutes,
13 | seconds=seconds
14 | )
15 |
--------------------------------------------------------------------------------
/image.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [[ -z "$@" ]]; then
4 | echo "Usage: $0 "
5 | exit
6 | fi
7 |
8 | source venv/bin/activate
9 | slug=$(echo "$@" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9][^a-z0-9]*/-/g')
10 |
11 | if [[ -f "results/$slug.png" ]]; then
12 | echo "results/$slug.png exists - skipping"
13 | exit
14 | fi
15 |
16 | python3 generate.py -in gradient -i 200 -p "$@" -s 400 400
17 | mv output.png results/$slug.png
18 |
--------------------------------------------------------------------------------
/app/scss/chip.scss:
--------------------------------------------------------------------------------
1 | vc-chip {
2 | .chip {
3 | margin: 8px 8px 0 0;
4 | font-family: sans-serif;
5 | background-color: #535c69;
6 | color: #f9f8ef;
7 | border-radius: 8px;
8 | padding: 8px;
9 | opacity: 0.8;
10 | width: auto;
11 | display: flex;
12 | align-items: center;
13 | }
14 | .remove {
15 | margin-left: 4px;
16 | color: #f9f8ef !important;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/vc/service/helper/midas/midas/base_model.py:
--------------------------------------------------------------------------------
1 | import torch
2 |
3 |
4 | class BaseModel(torch.nn.Module):
5 | def load(self, path):
6 | """Load model from file.
7 |
8 | Args:
9 | path (str): file path
10 | """
11 | parameters = torch.load(path, map_location=torch.device('cpu'))
12 |
13 | if "optimizer" in parameters:
14 | parameters = parameters["model"]
15 |
16 | self.load_state_dict(parameters)
17 |
--------------------------------------------------------------------------------
/app/ts/managers/user-manager.ts:
--------------------------------------------------------------------------------
1 | import {User} from "../models/user";
2 | import {BaseManager} from "./base-manager";
3 |
4 | // @todo BaseManager
5 | export class UserManager extends BaseManager {
6 | base_url = '/api/user/me'
7 |
8 | public user: User;
9 |
10 | get(): Promise {
11 | return this.fetch().then((user) => {
12 | user = user as User;
13 | this.user = user;
14 | return user;
15 | });
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/scripts/restore.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source /opt/vc/.env
4 |
5 | set -x
6 |
7 | dbp() {
8 | PGPASSWORD=$DB_PASS psql --user=$DB_USER --host=$DB_HOST --port=$DB_PORT postgres -c "$@"
9 | }
10 | dbp "SELECT pg_terminate_backend(pid)
11 | FROM pg_stat_activity
12 | WHERE pid <> pg_backend_pid()
13 | AND datname = 'vc'"
14 | dbp "DROP DATABASE vc"
15 | dbp "CREATE DATABASE vc WITH OWNER vc"
16 |
17 | PGPASSWORD=$DB_PASS psql --user=$DB_USER --host=$DB_HOST --port=$DB_PORT $DB_NAME < backup.sql
18 |
--------------------------------------------------------------------------------
/index.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function doit () {
4 | rsync -a vc:/opt/vc/results/ results/
5 |
6 | echo "window.imagePaths = [" > images.js
7 |
8 | for i in $(ls -1t results/*.{png,mp4}); do
9 | echo "'$i'," >> images.js
10 | done
11 |
12 | echo "];window.handler.drawImages();" >> images.js
13 |
14 | echo "index.sh: last pull:" $(date)
15 | }
16 |
17 | if [[ -z "$1" ]]; then
18 | doit
19 | else
20 | while true; do
21 | doit
22 | sleep 150
23 | clear
24 | done
25 | fi
26 |
--------------------------------------------------------------------------------
/vc/exception/vc_exception.py:
--------------------------------------------------------------------------------
1 | class VcException(Exception):
2 | message = "An error occurred"
3 |
4 | def __init__(self, message: str = None):
5 | super().__init__()
6 | if message is not None:
7 | self.message = message
8 |
9 | def __repr__(self):
10 | return self.message
11 |
12 | def __str__(self):
13 | return self.message
14 |
15 | @classmethod
16 | def for_exception(cls, e: Exception):
17 | return cls(getattr(e, 'message', str(e)))
18 |
--------------------------------------------------------------------------------
/app/scss/_container.scss:
--------------------------------------------------------------------------------
1 | @import "news";
2 |
3 | .content {
4 | flex-grow: 1;
5 | overflow: hidden;
6 | display: flex;
7 |
8 | @include mobile {
9 | flex-direction: column;
10 | }
11 |
12 | @import "chipset";
13 | @import "info";
14 |
15 | .scrollable {
16 | overflow: auto;
17 | flex-grow: 1;
18 | display: flex;
19 | flex-direction: column;
20 |
21 | @import "login_form";
22 | @import "generation_requests";
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/vc/event/base.py:
--------------------------------------------------------------------------------
1 | from typing import Callable
2 | from whistle import Event, EventDispatcher
3 |
4 |
5 | class VcEvent(Event):
6 | id: str
7 |
8 |
9 | class VcEventDispatcher:
10 | dispatcher: EventDispatcher
11 |
12 | def __init__(self):
13 | self.dispatcher = EventDispatcher()
14 |
15 | def dispatch(self, event: VcEvent):
16 | self.dispatcher.dispatch(event.id, event)
17 |
18 | def register(self, event_id, fn: Callable):
19 | self.dispatcher.add_listener(event_id, fn)
20 |
--------------------------------------------------------------------------------
/vc/service/job.py:
--------------------------------------------------------------------------------
1 | from injector import inject
2 |
3 | from vc.service.queue import QueueService
4 |
5 |
6 | class JobService:
7 | queue_service: QueueService
8 |
9 | @inject
10 | def __init__(self, queue_service: QueueService):
11 | self.queue_service = queue_service
12 |
13 | def enqueue(self, job: str, *args) -> str:
14 | return self.queue_service.enqueue(job + '.handle', args=args)
15 |
16 | def cancel(self, hash: str):
17 | self.queue_service.cancel_and_stop(hash)
18 |
--------------------------------------------------------------------------------
/.bashrc:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | pyv () {
4 | python -m trace -t $1 | grep $1
5 | }
6 |
7 | venv() {
8 | python3 -m venv venv
9 | source venv/bin/activate
10 | # pip install -r requirements.txt
11 | }
12 |
13 | run() {
14 | export FLASK_ENV=development
15 | export FLASK_APP="vc:create_app()"
16 | flask run --host=0.0.0.0
17 | }
18 |
19 |
20 | # needed for inpainting - see docker/flask/Dockerfile
21 | # Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &
22 | # export DISPLAY=:0
23 |
24 | venv
25 |
--------------------------------------------------------------------------------
/app/ts/models/image-spec.ts:
--------------------------------------------------------------------------------
1 | export class ImageSpec {
2 | texts: string[] = [];
3 | styles: string[] = [];
4 | iterations ?: number;
5 | upscale ?: boolean;
6 | }
7 |
8 | export class VideoStepSpec extends ImageSpec {
9 | init_iterations ?: number;
10 | epochs ?: number;
11 | x_velocity ?: number;
12 | y_velocity ?: number;
13 | z_velocity ?: number;
14 | pan_velocity ?: number;
15 | tilt_velocity ?: number;
16 | roll_velocity ?: number;
17 | interpolate ?: boolean;
18 | transition ?: number;
19 | }
20 |
--------------------------------------------------------------------------------
/vc/service/helper/esrgan/archs/__init__.py:
--------------------------------------------------------------------------------
1 | import importlib
2 | from basicsr.utils import scandir
3 | from os import path as osp
4 |
5 | # automatically scan and import arch modules for registry
6 | # scan all the files that end with '_arch.py' under the archs folder
7 | arch_folder = osp.dirname(osp.abspath(__file__))
8 | arch_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(arch_folder) if v.endswith('_arch.py')]
9 | # import all the arch modules
10 | _arch_modules = [importlib.import_module(f'vc.service.helper.esrgan.archs.{file_name}') for file_name in arch_filenames]
11 |
--------------------------------------------------------------------------------
/latest.py:
--------------------------------------------------------------------------------
1 | import dotenv
2 | import requests
3 | import shutil
4 | from datetime import datetime
5 |
6 | print("Running latest %s" % datetime.now())
7 |
8 | response = requests.get(
9 | 'https://vc.ajmoon.com/api/generation-request/',
10 | headers={
11 | "Authorization": "Bearer %s" % dotenv.get_key('.env', 'APP_KEY')
12 | }
13 | )
14 | if response.status_code == 200:
15 | print('- got latest, replacing latest.json')
16 | # print(response.text);exit()
17 | with open('/opt/vc/app/assets/latest.json', 'w') as outfile:
18 | outfile.write(response.text)
19 |
--------------------------------------------------------------------------------
/docker/flask/Dockerfile:
--------------------------------------------------------------------------------
1 | # FROM pytorch/pytorch:1.9.0-cuda11.1-cudnn8-runtime
2 | FROM ubuntu:20.04
3 |
4 | WORKDIR /opt/vc
5 |
6 | RUN apt update \
7 | && apt install -y software-properties-common \
8 | && add-apt-repository -y ppa:deadsnakes/ppa \
9 | && apt update
10 |
11 | RUN apt install -y \
12 | python3.9 \
13 | python3-pip \
14 | python3-venv \
15 | vim \
16 | less \
17 | git \
18 | wget \
19 | curl \
20 | ffmpeg \
21 | zip \
22 | redis-tools
23 |
24 | RUN pip3 install uwsgi
25 |
26 | EXPOSE 5000
27 |
28 | CMD './docker.flask.sh'
29 |
--------------------------------------------------------------------------------
/vc/service/helper/esrgan/models/__init__.py:
--------------------------------------------------------------------------------
1 | import importlib
2 | from basicsr.utils import scandir
3 | from os import path as osp
4 |
5 | # automatically scan and import model modules for registry
6 | # scan all the files that end with '_model.py' under the model folder
7 | model_folder = osp.dirname(osp.abspath(__file__))
8 | model_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(model_folder) if v.endswith('_model.py')]
9 | # import all the model modules
10 | _model_modules = [importlib.import_module(f'vc.service.helper.esrgan.models.{file_name}') for file_name in model_filenames]
11 |
--------------------------------------------------------------------------------
/vc/service/helper/esrgan/data/__init__.py:
--------------------------------------------------------------------------------
1 | import importlib
2 | from basicsr.utils import scandir
3 | from os import path as osp
4 |
5 | # automatically scan and import dataset modules for registry
6 | # scan all the files that end with '_dataset.py' under the data folder
7 | data_folder = osp.dirname(osp.abspath(__file__))
8 | dataset_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(data_folder) if v.endswith('_dataset.py')]
9 | # import all the dataset modules
10 | _dataset_modules = [importlib.import_module(f'vc.service.helper.esrgan.data.{file_name}') for file_name in dataset_filenames]
11 |
--------------------------------------------------------------------------------
/migrations/script.py.mako:
--------------------------------------------------------------------------------
1 | """${message}
2 |
3 | Revision ID: ${up_revision}
4 | Revises: ${down_revision | comma,n}
5 | Create Date: ${create_date}
6 |
7 | """
8 | from alembic import op
9 | import sqlalchemy as sa
10 | ${imports if imports else ""}
11 |
12 | # revision identifiers, used by Alembic.
13 | revision = ${repr(up_revision)}
14 | down_revision = ${repr(down_revision)}
15 | branch_labels = ${repr(branch_labels)}
16 | depends_on = ${repr(depends_on)}
17 |
18 |
19 | def upgrade():
20 | ${upgrades if upgrades else "pass"}
21 |
22 |
23 | def downgrade():
24 | ${downgrades if downgrades else "pass"}
25 |
--------------------------------------------------------------------------------
/requirements.worker.txt:
--------------------------------------------------------------------------------
1 | basicsr>=1.3.3.11
2 | cynetworkx==2.2rc1.dev20180527181709
3 | cython==0.29.24
4 | facexlib>=0.2.0.3
5 | gfpgan>=0.2.1
6 | hsluv==5.0.2
7 | imageio==2.9.0
8 | imageio-ffmpeg==0.4.4
9 | kiwisolver==1.3.1
10 | kornia==0.5.7
11 | moviepy==1.0.2
12 | networkx==2.3
13 | numpy==1.19.5
14 | opencv-python>=4
15 | pillow>=8.3.2
16 | pygments==2.9.0
17 | pytorch-lightning==1.4.0
18 | pytorch-ranger==0.1.1
19 | scikit-image
20 | tensorboard==2.4.1
21 | tensorboard-plugin-wit==1.8.0
22 | timm==0.4.5
23 | torchmetrics==0.4.1
24 | torch-optimizer==0.1.0
25 | transforms3d==0.3.1
26 | vispy==0.8.1
27 | zipp==3.5.0
28 |
--------------------------------------------------------------------------------
/.env.example:
--------------------------------------------------------------------------------
1 | DEBUG=True
2 | DEBUG_FILES=
3 |
4 | DB_HOST=127.0.0.1
5 | DB_PORT=5432
6 | DB_NAME=vc
7 | DB_USER=vc
8 | DB_PASS=vc
9 | SQLALCHEMY_TRACK_MODIFICATIONS=False
10 |
11 | REDIS_HOST=127.0.0.1
12 | REDIS_PORT=6379
13 | REDIS_PASS=vc
14 |
15 | AWS_ACCESS_KEY_ID=aws-access-key-id
16 | AWS_SECRET_ACCESS_KEY=aws-secret-access-key
17 | AWS_BUCKET_NAME=unique-bucket-name
18 | AWS_BUCKET_REGION=eu-west-1
19 |
20 | APP_ADMIN_EMAIL=email@goes.here
21 | APP_ADMIN_TOKEN=api-token-goes-here
22 | APP_KEY=not-sure-what-this-is
23 |
24 | IMAGE_WIDTH_SM=533
25 | IMAGE_HEIGHT_SM=300
26 | IMAGE_WIDTH_LG=1280
27 | IMAGE_HEIGHT_LG=720
28 |
29 | ROLE=worker
30 |
--------------------------------------------------------------------------------
/vc/model/base.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy.sql import func
2 |
3 | from vc.db import db
4 |
5 |
6 | class BaseModel:
7 | FIELDS = []
8 | GOD_FIELDS = []
9 |
10 | id = db.Column(db.Integer, primary_key=True)
11 | created = db.Column(
12 | db.DateTime,
13 | nullable=False,
14 | server_default=func.now()
15 | )
16 | updated = db.Column(
17 | db.DateTime,
18 | nullable=False,
19 | server_default=func.now(),
20 | onupdate=func.now()
21 | )
22 | deleted = db.Column(db.DateTime)
23 |
24 | def __repr__(self):
25 | return '<%s %r>' % (self.__class__.__name__, self.id)
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | /app/assets/latest.json
3 | backup.sql
4 | backup.sql.bak
5 | BoostingMonocularDepth
6 | checkpoints
7 | CLIP
8 | depth
9 | .env
10 | .idea
11 | images.js
12 | /input
13 | *.log
14 | log
15 | log_file
16 | mesh
17 | model.pt
18 | *.mp4
19 | node_modules
20 | notes.txt
21 | /planning
22 | /*.png
23 | public/*
24 | __pycache__
25 | /pytti
26 | results
27 | results.zip
28 | steps
29 | styles.txt
30 | taming
31 | taming-transformers
32 | tests
33 | tests.txt
34 | /tmp
35 | vc/service/helper/abme/correlation_package/
36 | venv
37 | venv.mac
38 | video
39 | weights
40 | *.xcf
41 | .env.local
42 | .env.live
43 | venv.bak
44 | redis.conf
45 | pgsql/
46 |
--------------------------------------------------------------------------------
/nginx.unsecure.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80;
3 | server_name _;
4 |
5 | access_log /var/log/nginx/vc.access.log;
6 | error_log /var/log/nginx/vc.error.log;
7 |
8 | location /api/ {
9 | proxy_pass http://127.0.0.1:5000/;
10 | proxy_redirect off;
11 |
12 | proxy_set_header Host $host;
13 | proxy_set_header X-Real-IP $remote_addr;
14 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
15 | proxy_set_header X-Forwarded-Proto $scheme;
16 | }
17 |
18 | location / {
19 | root /opt/vc/public;
20 | index index.html index.htm;
21 | try_files $uri $uri/ /index.html;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/diagnosis.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | while true; do
4 | echo 'Diagnostics as at ' $(date)
5 | echo 'top'
6 | top -bn1 -o +%MEM | head -n10 | tail -n4 | awk '{ printf("%-8s %-8s %-8s\n", $9, $10, $12); }'
7 | echo
8 | echo 'db'
9 | pass=$(cat .env | grep SQLALCHEMY_DATABASE_URI | awk -F':' '{ print $3 }' | awk -F'@' '{ print $1 }')
10 | PGPASSWORD=$pass psql --user=vc --host=127.0.0.1 vc "$@" -A -c "
11 | SELECT id, started, completed, failed, steps_completed, steps_total
12 | FROM generation_request WHERE id = (SELECT MAX(id) FROM generation_request)
13 | "
14 | echo
15 | echo 'logs'
16 | grep "DEBUG.*DEBUG" log/vc.* | tail -n10
17 | sleep 5
18 | clear
19 | done
20 |
--------------------------------------------------------------------------------
/vc/command/trigger.py:
--------------------------------------------------------------------------------
1 | from injector import inject
2 |
3 | from vc.command.base import BaseCommand
4 | from vc.manager import GenerationRequestManager
5 |
6 |
7 | class TriggerCommand(BaseCommand):
8 | description = 'Sends a job to the generation queue'
9 | args = [
10 | {
11 | 'dest': 'id',
12 | 'type': int,
13 | 'help': 'Request id',
14 | }
15 | ]
16 |
17 | manager: GenerationRequestManager
18 |
19 | @inject
20 | def __init__(self, manager: GenerationRequestManager):
21 | self.manager = manager
22 |
23 | def handle(self, args):
24 | print('Triggering %s' % args.id)
25 | self.manager.trigger(args.id)
26 |
--------------------------------------------------------------------------------
/app/scss/_news.scss:
--------------------------------------------------------------------------------
1 | @import "theme";
2 |
3 | .content.news {
4 | @import "news/nav";
5 |
6 | .scrollable {
7 | background: #f9f8ef;
8 |
9 | .hero {
10 | height: 232px;
11 | width: 100%;
12 | img {
13 | height: 232px;
14 | max-width: 100%;
15 | object-fit: cover;
16 | object-position: top left;
17 | }
18 | }
19 | .help {
20 | height: 100%;
21 | display: flex;
22 | flex-direction: column;
23 | align-items: center;
24 | justify-content: center;
25 | }
26 | @import "news/text";
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/ts/models/generation-request.ts:
--------------------------------------------------------------------------------
1 | import {GenerationResult} from "./generation-result";
2 | import {GenerationSpec} from "./generation-spec";
3 | import {BaseModel} from "./base-model";
4 |
5 | export class GenerationRequest extends BaseModel {
6 | spec ?: GenerationSpec;
7 | name ?: string;
8 | preview ?: string;
9 | interim ?: string;
10 | interim_watermarked ?: string;
11 | steps_completed ?: number;
12 | steps_total ?: number;
13 | results ?: GenerationResult[];
14 |
15 | started ?: string;
16 | completed ?: string;
17 | failed ?: string;
18 |
19 | cancelled ?: string;
20 | retried ?: string;
21 | deleted ?: string;
22 |
23 | published ?: string;
24 | }
25 |
--------------------------------------------------------------------------------
/scripts/sh.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # helper functions
4 | function confirm() {
5 | while true; do
6 | read -p "[Y/n] " YESNO
7 | case "$YESNO" in
8 | [Yy]*|"" ) return 0;;
9 | [Nn]* ) return 1;;
10 | * ) printf "Try again hotshot. " ;;
11 | esac
12 | done
13 | }
14 |
15 | red="$(tput setaf 1)"
16 | green="$(tput setaf 2)"
17 | yellow="$(tput setaf 3)"
18 | reset="$(tput sgr0)"
19 | function red() { echo "${red}${@}${reset}"; }
20 | function green() { echo "${green}${@}${reset}"; }
21 | function yellow() { echo "${yellow}${@}${reset}"; }
22 |
23 | service=$1
24 | if [[ -z "$service" ]]; then
25 | service=flask
26 | fi
27 |
28 | docker-compose exec $service bash -i
29 |
--------------------------------------------------------------------------------
/scripts/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | red="$(tput setaf 1)"
4 | green="$(tput setaf 2)"
5 | yellow="$(tput setaf 3)"
6 | reset="$(tput sgr0)"
7 | function red() { echo "${red}${@}${reset}"; }
8 | function green() { echo "${green}${@}${reset}"; }
9 | function yellow() { echo "${yellow}${@}${reset}"; }
10 |
11 | service=$1
12 | if [[ -z "$service" ]]; then
13 | service=flask
14 | fi
15 |
16 | green "Stopping docker containers"
17 | docker-compose down
18 |
19 | green "Starting docker containers"
20 | docker-compose up -d
21 |
22 | green "Obtaining shell for $service"
23 | docker-compose exec $service bash -i
24 |
25 | green "Your containers are still running"
26 | echo "Do task sh to obtain another shell"
27 | echo "Do task run to restart containers"
28 |
--------------------------------------------------------------------------------
/app/ts/helpers/notification.ts:
--------------------------------------------------------------------------------
1 | import {Unnotify} from "../lib/unnotify";
2 |
3 | export class Notification {
4 | private un: Unnotify = null;
5 |
6 | public constructor() {
7 | this.un = new Unnotify('right', true);
8 | }
9 |
10 | public error(error: Error, message: string = null, title: string = null) {
11 | let content = error.message;
12 | if (message !== null) {
13 | content += ': ' + message;
14 | }
15 | if (title === null) {
16 | title = 'Something went wrong';
17 | }
18 | this.show(title, content, 'danger');
19 | }
20 |
21 | private show(title: string, content: string, type: string) {
22 | this.un.show(title, content, {type});
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/scss/vc.scss:
--------------------------------------------------------------------------------
1 | @import "theme";
2 |
3 | html, body {
4 | width: 100%;
5 | height: 100%;
6 | margin: 0;
7 | padding: 0;
8 | font-family: 'Roboto Slab', serif;
9 | }
10 |
11 | a {
12 | text-decoration: none;
13 | color: #63575b;
14 | }
15 | a:hover {
16 | color: #655f62;
17 | }
18 | a:active {
19 | color: #676666;
20 | }
21 |
22 | .container {
23 | height: 100%;
24 | display: flex;
25 | flex-direction: column;
26 | justify-content: space-between;
27 |
28 | @import "header";
29 | @import "container";
30 | @import "footer";
31 | }
32 |
33 | button.unnotify-button {
34 | color: white;
35 | }
36 |
37 | // @todo why is this suddenly necessary?
38 | .material-icons {
39 | font-family: 'Material Icons', serif !important;
40 | }
41 |
--------------------------------------------------------------------------------
/vc/event/generation_request.py:
--------------------------------------------------------------------------------
1 | from vc.event.base import VcEvent
2 | from vc.model.generation_request import GenerationRequest
3 | from vc.model.user import User
4 |
5 |
6 | class GenerationRequestCreatedEvent(VcEvent):
7 | id = 'generation_request.created'
8 | generation_request: GenerationRequest
9 | user: User
10 |
11 | def __init__(self, generation_request: GenerationRequest, user: User=None):
12 | self.generation_request = generation_request
13 | self.user = user
14 |
15 |
16 | class GenerationRequestCancelledEvent(VcEvent):
17 | id = 'generation_request.cancelled'
18 | generation_request: GenerationRequest
19 | user: User
20 |
21 | def __init__(self, generation_request: GenerationRequest, user: User):
22 | self.generation_request = generation_request
23 | self.user = user
24 |
--------------------------------------------------------------------------------
/vc/service/helper/abme/Upsample.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn.functional as F
3 |
4 | def upsample_kernel2d(w, device):
5 | c = w // 2
6 | kernel = 1 - torch.abs(c - torch.arange(w, dtype=torch.float32, device=device)) / (c + 1)
7 | kernel = kernel.repeat(w).view(w,-1) * kernel.unsqueeze(1)
8 | return kernel.view(1, 1, w, w)
9 |
10 | def Upsample(img, factor):
11 | if factor == 1:
12 | return img
13 | B, C, H, W = img.shape
14 | batch_img = img.view(B*C, 1, H, W)
15 | batch_img = F.pad(batch_img, [0, 1, 0, 1], mode='replicate')
16 | kernel = upsample_kernel2d(factor * 2 - 1, img.device)
17 | upsamp_img = F.conv_transpose2d(batch_img, kernel, stride=factor, padding=(factor-1))
18 | upsamp_img = upsamp_img[:, :, : -1, :-1]
19 | _, _, H_up, W_up = upsamp_img.shape
20 | return upsamp_img.view(B, C, H_up, W_up)
--------------------------------------------------------------------------------
/vc/service/helper/hash.py:
--------------------------------------------------------------------------------
1 | import bcrypt
2 | import os
3 | import hashlib
4 | import base64
5 |
6 |
7 | class HashHelper:
8 | @classmethod
9 | def get(cls, value: str):
10 | salt = cls.get_salt(value)
11 | return bcrypt.hashpw(
12 | value.encode('utf-8'),
13 | salt
14 | ).decode()
15 |
16 | @classmethod
17 | def get_salt(cls, value: str):
18 | return os.getenv('SALT').encode('utf-8')
19 |
20 | @classmethod
21 | def get_salt_not_working(cls, value: str):
22 | secret_key = os.getenv('APP_KEY')
23 |
24 | hmac_obj = hashlib.sha256(secret_key.encode('utf-8'))
25 | hmac_obj.update(value.encode('utf-8'))
26 | hmac_digest = hmac_obj.digest()
27 |
28 | salt_value = base64.b64encode(hmac_digest)[:22]
29 | return ('$2b$12$%s' % salt_value.decode('utf-8')).encode('utf-8')
30 |
--------------------------------------------------------------------------------
/app/ts/elements.ts:
--------------------------------------------------------------------------------
1 | export * from './elements/generation-requests'
2 | export * from './elements/generation-request'
3 | export * from './elements/generation-request/details'
4 | export * from './elements/generation-request/step'
5 | export * from './elements/generation-request/summary'
6 | export * from './elements/news/nav'
7 | export * from './elements/login-form'
8 | export * from './elements/login'
9 | export * from './elements/generation-request-form'
10 | export * from './elements/generation-request-form/add-spec'
11 | export * from './elements/generation-request-form/image-spec-form'
12 | export * from './elements/generation-request-form/image-spec-option'
13 | export * from './elements/generation-request-form/video-spec-form'
14 | export * from './elements/generation-request-form/add-video-step'
15 | export * from './elements/chipset'
16 | export * from './elements/chip'
17 | export * from './elements/info'
18 |
--------------------------------------------------------------------------------
/app/scss/generation_request_form/_video_spec_form.scss:
--------------------------------------------------------------------------------
1 | @import "../theme";
2 |
3 | vc-video-spec-form {
4 | .video-spec-form {
5 | background-color: #ebdeca;
6 | padding: 8px;
7 | border-radius: $border-radius;
8 | border: solid $border-width #5c6267;
9 | box-sizing: border-box;
10 | width: 100%;
11 | margin-bottom: 16px;
12 |
13 | button {
14 | width: 32px !important;
15 | height: 32px !important;
16 | font-size: 32px !important;
17 | line-height: 32px !important;
18 | }
19 |
20 | .spec-header {
21 | display: flex;
22 | justify-content: space-between;
23 | align-items: center;
24 | h3 {
25 | margin: 0;
26 | padding: 0;
27 | }
28 | }
29 |
30 | h3 {
31 | margin: 0;
32 | padding: 0;
33 | }
34 |
35 | .steps {
36 | margin: 8px;
37 | @import 'add_video_step';
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/scss/generation_request_form/_add_spec.scss:
--------------------------------------------------------------------------------
1 | @import "../theme";
2 |
3 | vc-add-spec {
4 | .add-spec {
5 | display: flex;
6 | background-color: #c5d9dd;
7 | padding: 8px;
8 | border-radius: $border-radius;
9 | border: solid $border-width #5c6267;
10 | box-sizing: border-box;
11 | width: 100%;
12 |
13 | .add-image, .add-video {
14 | height: 128px;
15 | background-color: #eaf1f2;
16 | padding: 8px;
17 | border-radius: $border-radius;
18 | border: solid 1px #5c6267;
19 | margin: 8px;
20 | flex-grow: 1;
21 | cursor: pointer;
22 | position: relative;
23 |
24 | &:hover {
25 | background-color: #f0f5f0;
26 |
27 | img {
28 | opacity: 1;
29 | }
30 | }
31 |
32 | img {
33 | position: absolute;
34 | left: calc(50% - 60px);
35 | opacity: 0.3;
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/scss/generation_request_form/_add_video_step.scss:
--------------------------------------------------------------------------------
1 | @import "../theme";
2 |
3 | vc-add-video-step {
4 | .add-video-step {
5 | display: flex;
6 | background-color: #c5d9dd;
7 | padding: 8px;
8 | border-radius: $border-radius;
9 | border: solid $border-width #5c6267;
10 | box-sizing: border-box;
11 | width: 100%;
12 |
13 | .add-image {
14 | height: 128px;
15 | background-color: #eaf1f2;
16 | padding: 8px;
17 | border-radius: $border-radius;
18 | border: solid 1px #5c6267;
19 | margin: 8px;
20 | flex-grow: 1;
21 | cursor: pointer;
22 | position: relative;
23 |
24 | &:hover {
25 | background-color: #f0f5f0;
26 |
27 | img {
28 | opacity: 1;
29 | }
30 | }
31 |
32 | img {
33 | position: absolute;
34 | left: calc(50% - 60px);
35 | opacity: 0.3;
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/vc/service/helper/abme/correlation_package/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | import os
3 | import torch
4 |
5 | from setuptools import setup, find_packages
6 | from torch.utils.cpp_extension import BuildExtension, CUDAExtension
7 |
8 | cxx_args = ['-std=c++14']
9 |
10 | nvcc_args = [
11 | '-gencode', 'arch=compute_50,code=sm_50',
12 | '-gencode', 'arch=compute_52,code=sm_52',
13 | '-gencode', 'arch=compute_60,code=sm_60',
14 | '-gencode', 'arch=compute_61,code=sm_61',
15 | '-gencode', 'arch=compute_70,code=sm_70',
16 | '-gencode', 'arch=compute_70,code=compute_70'
17 | ]
18 |
19 | setup(
20 | name='correlation_cuda',
21 | ext_modules=[
22 | CUDAExtension('correlation_cuda', [
23 | 'correlation_cuda.cc',
24 | 'correlation_cuda_kernel.cu'
25 | ], extra_compile_args={'cxx': cxx_args, 'nvcc': nvcc_args})
26 | ],
27 | cmdclass={
28 | 'build_ext': BuildExtension
29 | })
30 |
--------------------------------------------------------------------------------
/app/scss/vc.css.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sourceRoot":"","sources":["vc.scss"],"names":[],"mappings":"AAAA;EACI;EACA;EACA;EACA;EACA;;;AAGJ;EACI;EACA;;;AAEJ;EACI;;;AAEJ;EACI;;;AAGJ;EACI;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAIR;EACI;EACA;EACA;EACA;;AAIR;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;;AAGJ;EACI;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAEA;EACI;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;;AAIR;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;;AAEA;EACI;;AAGJ;EACI;EACA;;AAIR;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAOpB;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;;AAEJ;EACI;EACA;;AAOpB;EACI;;AAGJ;EACI;EACA;EACA;EACA;;AAGJ;EACI;EACA;;AAGJ;EACI;EACA;;AAGJ;EACI;IACI;;EAGJ;IACI;;EAGJ;IACI;;EAGJ;IACI;IACA;IACA;;EAGJ;IACI;IACA;;EAGJ;IACI;;EAGJ;IACI;IACA;IACA;;;AAIR;EACI;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAGJ;EACI;;AAGJ;EACI","file":"vc.css"}
--------------------------------------------------------------------------------
/vc/service/helper/dimensions.py:
--------------------------------------------------------------------------------
1 | import dotenv
2 |
3 |
4 | class DimensionsHelper:
5 | IMAGE_WIDTH_SM = 400
6 | IMAGE_HEIGHT_SM = 400
7 | IMAGE_WIDTH_LG = 800
8 | IMAGE_HEIGHT_LG = 800
9 |
10 | @classmethod
11 | def width_small(cls):
12 | return int(
13 | dotenv.get_key('.env', 'IMAGE_WIDTH_SM')
14 | or cls.IMAGE_WIDTH_SM
15 | )
16 |
17 | @classmethod
18 | def height_small(cls):
19 | return int(
20 | dotenv.get_key('.env', 'IMAGE_HEIGHT_SM')
21 | or cls.IMAGE_HEIGHT_SM
22 | )
23 |
24 | @classmethod
25 | def width_large(cls):
26 | return int(
27 | dotenv.get_key('.env', 'IMAGE_WIDTH_LG')
28 | or cls.IMAGE_WIDTH_LG
29 | )
30 |
31 | @classmethod
32 | def height_large(cls):
33 | return int(
34 | dotenv.get_key('.env', 'IMAGE_HEIGHT_LG')
35 | or cls.IMAGE_HEIGHT_LG
36 | )
37 |
--------------------------------------------------------------------------------
/app/scss/_normalize.scss:
--------------------------------------------------------------------------------
1 | @import "config";
2 |
3 | /**
4 | * 1. Change the font styles in all browsers.
5 | * 2. Remove the margin in Firefox and Safari.
6 | */
7 |
8 | button,
9 | input,
10 | optgroup,
11 | select,
12 | textarea {
13 | font-family: inherit; /* 1 */
14 | font-size: 100%; /* 1 */
15 | line-height: 1.15; /* 1 */
16 | margin: 0; /* 2 */
17 | }
18 |
19 | /**
20 | * Show the overflow in IE.
21 | * 1. Show the overflow in Edge.
22 | */
23 |
24 | button,
25 | input { /* 1 */
26 | overflow: visible;
27 | }
28 |
29 | /**
30 | * Remove the inheritance of text transform in Edge, Firefox, and IE.
31 | * 1. Remove the inheritance of text transform in Firefox.
32 | */
33 |
34 | button,
35 | select { /* 1 */
36 | text-transform: none;
37 | }
38 |
39 | /**
40 | * Correct the inability to style clickable types in iOS and Safari.
41 | */
42 |
43 | button,
44 | [type="button"],
45 | [type="reset"],
46 | [type="submit"] {
47 | -webkit-appearance: button;
48 | }
49 |
--------------------------------------------------------------------------------
/app/ts/elements/login.ts:
--------------------------------------------------------------------------------
1 | import {CustomElement} from 'custom-elements-ts';
2 | import {BaseElement} from "./base-element";
3 |
4 | @CustomElement({
5 | tag: 'vc-login',
6 | shadow: false,
7 | style: ``,
8 | template: `
9 |
10 |
13 |
14 | `
15 | })
16 | export class Login extends BaseElement {
17 | $root: HTMLElement;
18 | $form: HTMLElement;
19 | $input: HTMLInputElement;
20 |
21 | constructor() {
22 | super();
23 | }
24 |
25 | connectedCallback() {
26 | this.$root = this.querySelector('.login');
27 | this.$form = this.$root.querySelector('form');
28 | this.$form.addEventListener('submit', this.submit.bind(this));
29 | this.$input = this.$form.querySelector('input');
30 | }
31 |
32 | submit(event: Event) {
33 | event.preventDefault();
34 | this.vc.authenticate(this.$input.value);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/vc/service/helper/tier.py:
--------------------------------------------------------------------------------
1 | from vc.model.user import User, UserTier
2 |
3 |
4 | class TierHelper:
5 | INTERIM_STEPS = 60
6 |
7 | @classmethod
8 | def get_user_roles(cls, user):
9 | result = []
10 | i = user.tier
11 | while i >= 0:
12 | result.append(i)
13 | i -= 1
14 | return result
15 |
16 | @classmethod
17 | def is_tier(cls, user: User, value):
18 | if user is None:
19 | return False
20 | return value in cls.get_user_roles(user)
21 |
22 | @classmethod
23 | def is_god(cls, user: User):
24 | return cls.is_tier(user, UserTier.God)
25 |
26 | @classmethod
27 | def is_artist(cls, user: User):
28 | return cls.is_tier(user, UserTier.Artist)
29 |
30 | @classmethod
31 | def is_coder(cls, user: User):
32 | return cls.is_tier(user, UserTier.Coder)
33 |
34 | @classmethod
35 | def is_supporter(cls, user: User):
36 | return cls.is_tier(user, UserTier.Supporter)
37 |
--------------------------------------------------------------------------------
/vc/service/helper/abme/correlation_package/nvcc setting.md:
--------------------------------------------------------------------------------
1 | # How to set the nvcc version (Default:CUDA-11.0)
2 |
3 | ## Pre-requisite
4 |
5 | Check installed `cuda-11.0` path:
6 | ```bash
7 | $ cd /usr/local
8 | $ find . -maxdepth 1 -name 'cuda-11.0'
9 | ```
10 | - If there is no `cuda-11.0` folder in the directory, install `cuda-11.0` first.
11 |
12 | ## Change environments of the terminal (temporal)
13 | Change your terminal `PATH` and `LD_LIBRARY_PATH`:
14 | ```bash
15 | $ export PATH=/usr/local/cuda-11.0/bin${PATH:+:${PATH}}
16 | $ export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64
17 | $ nvcc --version
18 | ```
19 | ## Change default environments of the terminal
20 | For change default `nvcc` version of your terminal, you should add below two lines in your `~/.bashrc`.
21 | ```bash
22 | $ gedit ~/.bashrc
23 | export PATH=/usr/local/cuda-11.0/bin${PATH:+:${PATH}}
24 | export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64
25 | ```
26 | Save and then open new terminal:
27 | ```bash
28 | $ nvcc --version
29 | ```
30 |
--------------------------------------------------------------------------------
/vc/model/user.py:
--------------------------------------------------------------------------------
1 | from flask_restful import fields
2 |
3 | from vc.db import db
4 | from vc.model.base import BaseModel
5 |
6 |
7 | class UserTier:
8 | Supporter = 0
9 | Coder = 1
10 | Artist = 2
11 | God = 3
12 |
13 |
14 | class User(db.Model, BaseModel):
15 | FIELDS = [
16 | 'name',
17 | 'email',
18 | ]
19 | GOD_FIELDS = [
20 | 'tier',
21 | ]
22 |
23 | api_token: str = None
24 |
25 | name = db.Column(db.String)
26 | email = db.Column(db.String, nullable=False)
27 | token = db.Column(db.String, nullable=False)
28 | tier = db.Column(db.Integer, nullable=False, default=0)
29 |
30 | requests = db.relationship('GenerationRequest', backref='user')
31 |
32 | schema = {
33 | 'id': fields.Integer,
34 | 'email': fields.String,
35 | 'name': fields.String,
36 | 'api_token': fields.String,
37 | 'created': fields.DateTime(),
38 | 'updated': fields.DateTime(),
39 | 'deleted': fields.DateTime(),
40 | }
41 |
--------------------------------------------------------------------------------
/vc/command/video.py:
--------------------------------------------------------------------------------
1 | from injector import inject
2 |
3 | from vc.command.base import BaseCommand
4 | from vc.service.video import VideoService
5 |
6 |
7 | class VideoCommand(BaseCommand):
8 | description = 'Makes a video from steps files'
9 | args = [
10 | {
11 | 'dest': 'fps_multiple',
12 | 'type': int,
13 | 'help': 'FPS multiple (1 or 4)',
14 | 'default': 4,
15 | },
16 | {
17 | 'dest': 'steps_dir',
18 | 'type': str,
19 | 'help': 'Steps dir',
20 | 'default': 'steps',
21 | 'nargs': '?',
22 | }
23 | ]
24 |
25 | video: VideoService
26 |
27 | @inject
28 | def __init__(self, video: VideoService):
29 | self.video = video
30 |
31 | def handle(self, args):
32 | self.video.make_unwatermarked_video(
33 | 'output.mp4',
34 | args.steps_dir,
35 | suffix='sofar',
36 | interpolate=False,
37 | fps_multiple=args.fps_multiple,
38 | )
39 |
--------------------------------------------------------------------------------
/app/scss/generation_request_form/_image_spec_option.scss:
--------------------------------------------------------------------------------
1 | @import "../theme";
2 |
3 | vc-image-spec-option {
4 | flex: 1 1 14%;
5 |
6 | .image-spec-option {
7 | display: flex;
8 | justify-content: flex-start;
9 |
10 | background: #eaf1f2;
11 | border: solid 1px #5c6267;
12 | border-radius: $border-radius;
13 | position: relative;
14 | margin: 8px 8px 0 0;
15 | padding: 8px;
16 | height: 2em;
17 |
18 | &:hover {
19 | background-color: #f0f5f0;
20 | }
21 |
22 | @include mobile {
23 | width: auto;
24 | margin: 8px 0 0;
25 | }
26 |
27 | label {
28 | align-items: center;
29 | display: flex;
30 | font-weight: bold;
31 | width: 100%;
32 | cursor: pointer;
33 | justify-content: space-between;
34 | }
35 |
36 | input {
37 | margin-left: 8px;
38 | height: 32px;
39 | }
40 |
41 | input[type=number] {
42 | width: 6em;
43 | padding: 0 8px;
44 | }
45 |
46 | input[type=checkbox] {
47 | width: 32px;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/ts/elements/info.ts:
--------------------------------------------------------------------------------
1 | import {CustomElement} from 'custom-elements-ts';
2 | import {BaseElement} from "./base-element";
3 |
4 | @CustomElement({
5 | tag: 'vc-info',
6 | shadow: false,
7 | style: ``,
8 | template: require('./info.inc')
9 | })
10 | export class Info extends BaseElement {
11 | $root: HTMLElement;
12 | $info: HTMLElement;
13 | $close: HTMLButtonElement;
14 | expanded = false;
15 |
16 | constructor() {
17 | super();
18 | }
19 |
20 | connectedCallback() {
21 | this.$root = this.querySelector('.info-container');
22 | this.$info = this.$root.querySelector('.info');
23 | this.$close = this.$info.querySelector('button.close');
24 | this.$close.addEventListener('click', () => {
25 | this.expand();
26 | });
27 | }
28 |
29 | expand() {
30 | this.expanded = !this.expanded;
31 | if (this.expanded) {
32 | this.$root.classList.add('expanded');
33 | } else {
34 | this.$root.classList.remove('expanded');
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/migrations/alembic.ini:
--------------------------------------------------------------------------------
1 | # A generic, single database configuration.
2 |
3 | [alembic]
4 | # template used to generate migration files
5 | # file_template = %%(rev)s_%%(slug)s
6 |
7 | # set to 'true' to run the environment during
8 | # the 'revision' command, regardless of autogenerate
9 | # revision_environment = false
10 |
11 |
12 | # Logging configuration
13 | [loggers]
14 | keys = root,sqlalchemy,alembic,flask_migrate
15 |
16 | [handlers]
17 | keys = console
18 |
19 | [formatters]
20 | keys = generic
21 |
22 | [logger_root]
23 | level = WARN
24 | handlers = console
25 | qualname =
26 |
27 | [logger_sqlalchemy]
28 | level = WARN
29 | handlers =
30 | qualname = sqlalchemy.engine
31 |
32 | [logger_alembic]
33 | level = INFO
34 | handlers =
35 | qualname = alembic
36 |
37 | [logger_flask_migrate]
38 | level = INFO
39 | handlers =
40 | qualname = flask_migrate
41 |
42 | [handler_console]
43 | class = StreamHandler
44 | args = (sys.stderr,)
45 | level = NOTSET
46 | formatter = generic
47 |
48 | [formatter_generic]
49 | format = %(levelname)-5.5s [%(name)s] %(message)s
50 | datefmt = %H:%M:%S
51 |
--------------------------------------------------------------------------------
/vc/controller/base.py:
--------------------------------------------------------------------------------
1 | from flask_restful import Resource
2 |
3 | from vc.auth import auth
4 | from vc.manager.user import UserManager
5 | from vc.service.helper.tier import TierHelper
6 |
7 |
8 | class BaseController(Resource):
9 | user_manager: UserManager
10 |
11 | def __init__(self, user_manager: UserManager, *args, **kwargs):
12 | super().__init__(*args, **kwargs)
13 | self.user_manager = user_manager
14 | auth.verify_token(self.verify_token)
15 | auth.get_user_roles(TierHelper.get_user_roles)
16 |
17 | def verify_token(self, token):
18 | return self.user_manager.authenticate(token)
19 |
20 | def current_user(self):
21 | return auth.current_user()
22 |
23 | def is_god(self):
24 | return TierHelper.is_god(self.current_user())
25 |
26 | def is_artist(self):
27 | return TierHelper.is_artist(self.current_user())
28 |
29 | def is_coder(self):
30 | return TierHelper.is_coder(self.current_user())
31 |
32 | def is_supporter(self):
33 | return TierHelper.is_supporter(self.current_user())
34 |
--------------------------------------------------------------------------------
/vc/command/esrgan.py:
--------------------------------------------------------------------------------
1 | from injector import inject
2 |
3 | from vc.command.base import BaseCommand
4 | from vc.service.esrgan import EsrganService, EsrganOptions
5 |
6 |
7 | class EsrganCommand(BaseCommand):
8 | description = 'Runs esrgan on an input file'
9 | args = [
10 | {
11 | 'dest': 'input_file',
12 | 'type': str,
13 | 'help': 'Input file',
14 | 'default': 'output.png',
15 | 'nargs': '?',
16 | },
17 | {
18 | 'dest': 'output_file',
19 | 'type': str,
20 | 'help': 'Output file',
21 | 'default': 'debug.png',
22 | 'nargs': '?',
23 | },
24 | ]
25 |
26 | esrgan: EsrganService
27 |
28 | @inject
29 | def __init__(self, esrgan: EsrganService):
30 | self.esrgan = esrgan
31 |
32 | def handle(self, args):
33 | print('got %s %s' % (args.input_file, args.output_file))
34 | self.esrgan.handle(EsrganOptions(
35 | input_file=args.input_file,
36 | output_file=args.output_file,
37 | ))
38 |
--------------------------------------------------------------------------------
/vc/model/generation_result.py:
--------------------------------------------------------------------------------
1 | from flask_restful import fields
2 |
3 | from vc.db import db
4 | from vc.model.base import BaseModel
5 |
6 |
7 | class GenerationResult(db.Model, BaseModel):
8 | FIELDS = [
9 | 'request_id',
10 | 'url',
11 | 'url_watermarked',
12 | ]
13 |
14 | request_id = db.Column(
15 | db.Integer,
16 | db.ForeignKey('generation_request.id'),
17 | nullable=False
18 | )
19 |
20 | url = db.Column(db.String, nullable=True)
21 | url_watermarked = db.Column(db.String, nullable=True)
22 |
23 | public_schema = {
24 | 'id': fields.Integer,
25 | 'url': fields.String,
26 | 'url_watermarked': fields.String,
27 | 'created': fields.DateTime(),
28 | 'updated': fields.DateTime(),
29 | 'deleted': fields.DateTime(),
30 | }
31 |
32 | private_schema = {
33 | 'id': fields.Integer,
34 | 'url_watermarked': fields.String,
35 | 'created': fields.DateTime(),
36 | 'updated': fields.DateTime(),
37 | 'deleted': fields.DateTime(),
38 | }
39 |
--------------------------------------------------------------------------------
/vc/event_listener/generation_request.py:
--------------------------------------------------------------------------------
1 | from injector import inject
2 |
3 | from vc.event import (
4 | GenerationRequestCreatedEvent,
5 | GenerationRequestCancelledEvent,
6 | )
7 | from vc.event_listener.base import VcEventListener
8 | from vc.service.job import JobService
9 |
10 |
11 | class GenerationRequestCreatedEventListener(VcEventListener):
12 | job_service: JobService
13 |
14 | @inject
15 | def __init__(self, job_service: JobService):
16 | self.job_service = job_service
17 |
18 | def on(self, event: GenerationRequestCreatedEvent):
19 | event.generation_request.hash = self.job_service.enqueue(
20 | 'vc.job.generation.GenerationJob',
21 | event.generation_request.id
22 | )
23 |
24 |
25 | class GenerationRequestCancelledEventListener(VcEventListener):
26 | job_service: JobService
27 |
28 | @inject
29 | def __init__(self, job_service: JobService):
30 | self.job_service = job_service
31 |
32 | def on(self, event: GenerationRequestCancelledEvent):
33 | self.job_service.cancel(event.generation_request.hash)
34 |
--------------------------------------------------------------------------------
/app/ts/helpers/auth.ts:
--------------------------------------------------------------------------------
1 | export class AuthHelper {
2 | private static token: string = null;
3 | private static callbacks: CallableFunction[] = [];
4 | private static authenticated = false;
5 |
6 | static getToken() {
7 | return AuthHelper.token;
8 | }
9 |
10 | static setToken(token: string) {
11 | AuthHelper.token = token
12 | || (new URLSearchParams(window.location.search)).get('token')
13 | || localStorage.getItem('vc-token');
14 | }
15 |
16 | static clearToken() {
17 | AuthHelper.token = null;
18 | AuthHelper.authenticated = false;
19 | }
20 |
21 | static authenticate() {
22 | AuthHelper.authenticated = true;
23 | localStorage.setItem('vc-token', AuthHelper.token);
24 | for (const callback of AuthHelper.callbacks) {
25 | callback(AuthHelper.token);
26 | }
27 | }
28 |
29 | static isAuthenticated() {
30 | return AuthHelper.authenticated;
31 | }
32 |
33 | static listen(callback: CallableFunction) {
34 | this.callbacks.push(callback);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Alex Moon
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/app/ts/elements/generation-request-form/add-video-step.ts:
--------------------------------------------------------------------------------
1 | import {
2 | CustomElement,
3 | Dispatch,
4 | DispatchEmitter,
5 | Listen
6 | } from 'custom-elements-ts';
7 | import {VideoSpec} from "../../models/video-spec";
8 |
9 | @CustomElement({
10 | tag: 'vc-add-video-step',
11 | shadow: false,
12 | style: ``,
13 | template: `
14 |
15 |
16 | Add step
17 |

18 |
19 |
20 | `,
21 | })
22 | export class AddVideoStep extends HTMLElement {
23 | $root: HTMLElement
24 | private spec: VideoSpec;
25 |
26 | @Dispatch() addedImage: DispatchEmitter;
27 |
28 | constructor() {
29 | super();
30 | }
31 |
32 | connectedCallback() {
33 | this.$root = this.querySelector('.add-spec');
34 | }
35 |
36 | @Listen('click', '.add-image')
37 | addImage() {
38 | this.addedImage.emit();
39 | }
40 |
41 | update(spec: VideoSpec) {
42 | this.spec = spec;
43 | this.draw();
44 | }
45 |
46 | draw() {
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/vqgan/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Katherine Crowson
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/ts/managers/generation-request-manager.ts:
--------------------------------------------------------------------------------
1 | import {GenerationRequest} from "../models/generation-request";
2 | import {BaseManager} from "./base-manager";
3 |
4 | export class GenerationRequestManager extends BaseManager {
5 | protected base_url = '/api/generation-request/'
6 |
7 | public index(): Promise {
8 | let url = '';
9 | if (this.isLocal) {
10 | url = '/assets/latest.json';
11 | }
12 | return this.fetch(url) as Promise;
13 | }
14 |
15 | public create(request: GenerationRequest) {
16 | return this.post(request);
17 | }
18 |
19 | public cancel(id: number) {
20 | return this.put(id + '/cancel');
21 | }
22 |
23 | public retry(id: number) {
24 | return this.put(id + '/retry');
25 | }
26 |
27 | public delete(id: number) {
28 | return this.put(id + '/delete');
29 | }
30 |
31 | public publish(id: number) {
32 | return this.put(id + '/publish');
33 | }
34 |
35 | public unpublish(id: number) {
36 | return this.put(id + '/unpublish');
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/scss/_header.scss:
--------------------------------------------------------------------------------
1 | .header {
2 | height: 64px;
3 | display: flex;
4 | background-color: #efedd4;
5 | box-sizing: border-box;
6 | padding: 16px;
7 |
8 | .header-first {
9 | flex: 0;
10 | display: flex;
11 | align-items: center;
12 |
13 | h1 {
14 | cursor: pointer;
15 | background: url('../assets/logo-sm.png');
16 | background-size: contain;
17 | width: 64px;
18 | height: 64px;
19 | margin: 0;
20 | padding: 0;
21 | color: rgba(0, 0, 0, 0);
22 | }
23 | }
24 |
25 | .header-second {
26 | flex: 1;
27 | display: flex;
28 | align-items: center;
29 | justify-content: flex-end;
30 |
31 | .header-button {
32 | cursor: pointer;
33 | background-size: contain;
34 | width: 28px;
35 | height: 28px;
36 | margin: 18px 8px;
37 | padding: 0;
38 | color: rgba(0, 0, 0, 0);
39 | }
40 |
41 | .info {
42 | background: url('../assets/help.png');
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/vc/service/helper/rife/model/warplayer.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 |
4 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
5 | backwarp_tenGrid = {}
6 |
7 |
8 | def warp(tenInput, tenFlow):
9 | k = (str(tenFlow.device), str(tenFlow.size()))
10 | if k not in backwarp_tenGrid:
11 | tenHorizontal = torch.linspace(-1.0, 1.0, tenFlow.shape[3], device=device).view(
12 | 1, 1, 1, tenFlow.shape[3]).expand(tenFlow.shape[0], -1, tenFlow.shape[2], -1)
13 | tenVertical = torch.linspace(-1.0, 1.0, tenFlow.shape[2], device=device).view(
14 | 1, 1, tenFlow.shape[2], 1).expand(tenFlow.shape[0], -1, -1, tenFlow.shape[3])
15 | backwarp_tenGrid[k] = torch.cat(
16 | [tenHorizontal, tenVertical], 1).to(device)
17 |
18 | tenFlow = torch.cat([tenFlow[:, 0:1, :, :] / ((tenInput.shape[3] - 1.0) / 2.0),
19 | tenFlow[:, 1:2, :, :] / ((tenInput.shape[2] - 1.0) / 2.0)], 1)
20 |
21 | g = (backwarp_tenGrid[k] + tenFlow).permute(0, 2, 3, 1)
22 | return torch.nn.functional.grid_sample(input=tenInput, grid=g, mode='bilinear', padding_mode='border', align_corners=True)
23 |
--------------------------------------------------------------------------------
/app/ts/elements/generation-requests.ts:
--------------------------------------------------------------------------------
1 | import {CustomElement} from 'custom-elements-ts';
2 | import {GenerationRequest as Model} from "../models/generation-request";
3 | import {GenerationRequest} from "./generation-request";
4 | import {BaseElement} from "./base-element";
5 |
6 | @CustomElement({
7 | tag: 'vc-generation-requests',
8 | shadow: false,
9 | style: ``,
10 | // @todo figure out how to make templateUrl work
11 | template: `
12 |
13 | `
14 | })
15 | export class GenerationRequests extends BaseElement {
16 | $root: HTMLElement;
17 |
18 | requests: Model[]
19 |
20 | constructor() {
21 | super();
22 | }
23 |
24 | connectedCallback() {
25 | this.$root = this.querySelector('.requests');
26 | }
27 |
28 | update(requests: Model[]) {
29 | this.requests = requests;
30 |
31 | this.$root.innerHTML = '';
32 | this.requests.forEach((request: Model) => {
33 | const $request = document.createElement('vc-generation-request') as GenerationRequest;
34 | this.$root.appendChild($request);
35 | $request.update(request);
36 | });
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/debug.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 |
16 |
17 |
18 |
19 |
20 |
21 |

22 |
Before
23 |
24 |
25 |

26 |
After
27 |
28 |
29 |
30 |

31 |

32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/partials/footer.html:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 |
23 |