diff --git a/main.py b/main.py index d8d03cf..11928f2 100644 --- a/main.py +++ b/main.py @@ -1,26 +1,26 @@ import argparse -import structlog +import concurrent.futures +import hashlib +import multiprocessing +import random +import sys +import time from functools import partial from pathlib import Path -import sys -import hashlib -import random -import multiprocessing -import concurrent.futures -import time import numpy as np +import structlog from src.utils.prereq import check_ffmpeg, install_ffmpeg check_ffmpeg() -from src.mediautils.audio import extract_audio_from_video -from src.mediautils.video import render_moments, filter_moments from src.editors.amplitude.editor import AmplitudeEditor from src.editors.sentiment.editor import SentimentEditor from src.math.cost import quadratic_loss from src.math.distribution import create_distribution +from src.mediautils.audio import extract_audio_from_video +from src.mediautils.video import filter_moments, render_moments log = structlog.get_logger() diff --git a/src/editors/amplitude/editor.py b/src/editors/amplitude/editor.py index d69760a..c7e9ae9 100644 --- a/src/editors/amplitude/editor.py +++ b/src/editors/amplitude/editor.py @@ -1,9 +1,10 @@ -from ...mediautils.audio import process_audio, resample -from ...math.average import np_moving_average -from ..common import find_moving_average_highlights import numpy as np import structlog +from ...math.average import np_moving_average +from ...mediautils.audio import process_audio, resample +from ..common import find_moving_average_highlights + class AmplitudeEditor: def __init__(self, video_path, audio_path, params): diff --git a/src/editors/sentiment/editor.py b/src/editors/sentiment/editor.py index 6b87c33..16d1b9b 100644 --- a/src/editors/sentiment/editor.py +++ b/src/editors/sentiment/editor.py @@ -1,13 +1,13 @@ -import whisper import json -from pathlib import Path import tempfile +from dataclasses import dataclass +from pathlib import Path + import numpy as np import structlog - -from flair.models import TextClassifier -from dataclasses import dataclass +import whisper from flair.data import Sentence +from flair.models import TextClassifier from ...math.average import np_moving_average from ..common import find_moving_average_highlights diff --git a/src/mediautils/audio.py b/src/mediautils/audio.py index f191106..841f212 100644 --- a/src/mediautils/audio.py +++ b/src/mediautils/audio.py @@ -1,6 +1,7 @@ import tempfile -import moviepy.editor as mp from pathlib import Path + +import moviepy.editor as mp import numpy as np import scipy.io.wavfile as wav diff --git a/src/utils/prereq.py b/src/utils/prereq.py index 1f8c8f2..5e73dfe 100644 --- a/src/utils/prereq.py +++ b/src/utils/prereq.py @@ -1,10 +1,11 @@ import os import platform import subprocess -import structlog -import click import sys +import click +import structlog + log = structlog.get_logger()