Skip to content

Commit

Permalink
move curses -> blessed for Windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
bes-dev committed Jun 9, 2021
1 parent 205dfda commit 6fa93b5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions random_face/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
limitations under the License.
"""
import argparse
import curses
import time
import cv2
import numpy as np
from random_face import get_engine
import random_face.functional as F

from blessed import Terminal

def main(args):
engine = get_engine()
Expand All @@ -33,16 +32,16 @@ def main(args):
fourcc = cv2.VideoWriter_fourcc(*'XVID')
video_writer = cv2.VideoWriter(args.save_video, fourcc, 15.0, (img.shape[0], img.shape[0]))

term = Terminal()
while True:
for i in range(args.n_steps):
weight = (1.0 / args.n_steps) * i
style = style_a + weight * (style_b - style_a)
start = time.time()
img = engine.style_to_img(style)
stop = time.time()
screen.addstr(0, 0, f"Processing time: {stop - start} s.")
screen.addstr(3, 0, "Press 'q' for quit")
screen.refresh()
print(term.clear() + term.move(0, 0) + f"Processing time: {stop - start} s.")
print(term.move(1, 0) + "Press 'q' for quit")
img = F.tensor_to_img(img)
if args.save_video is not None:
video_writer.write(img)
Expand Down

0 comments on commit 6fa93b5

Please sign in to comment.