mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
Fix linters. Add --video if not provided
This commit is contained in:
@@ -3347,6 +3347,8 @@ class ForecastController(BaseController):
|
||||
parser = self.add_standard_args(
|
||||
parser,
|
||||
)
|
||||
if other_args and "--video" not in other_args:
|
||||
other_args.insert(0, "--video")
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
other_args,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Utilize OpenAI Whisper to transcribe and summarize text"""
|
||||
__docformat__ = "numpy"
|
||||
# pylint: disable=I0011,C0413
|
||||
# pylint: disable=I0011,C0413,R0915,R0912,R0914
|
||||
import logging
|
||||
import os
|
||||
import tempfile
|
||||
@@ -76,11 +76,11 @@ def transcribe_and_summarize(
|
||||
if video == "":
|
||||
console.print("[red]Please provide a video URL. [/red]")
|
||||
return
|
||||
else:
|
||||
# check to make sure the video is a valid URL with a .com
|
||||
if not ((video.startswith("https") or "youtube" in video) and ".com" in video):
|
||||
console.print("[red]Please provide a valid video URL. [/red]")
|
||||
return
|
||||
|
||||
# check to make sure the video is a valid URL with a .com
|
||||
if not ((video.startswith("https") or "youtube" in video) and ".com" in video):
|
||||
console.print("[red]Please provide a valid video URL. [/red]")
|
||||
return
|
||||
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
@@ -300,8 +300,7 @@ def transcribe_and_summarize(
|
||||
(1 - (summary_text_length / original_text_length)) * 100, 2
|
||||
)
|
||||
# if there is negative reduction, set to 0
|
||||
if percent_reduction < 0:
|
||||
percent_reduction = 0
|
||||
percent_reduction = max(percent_reduction, 0)
|
||||
|
||||
console.print("")
|
||||
console.print("-------------------------")
|
||||
|
||||
@@ -48,7 +48,7 @@ def break_line(line: str, length: int):
|
||||
|
||||
def process_segment(segment: dict, line_length: int = 0):
|
||||
segment["text"] = segment["text"].strip()
|
||||
if line_length > 0 and len(segment["text"]) > line_length:
|
||||
if line_length and len(segment["text"]) > line_length:
|
||||
# break at N characters as per Netflix guidelines
|
||||
segment["text"] = break_line(segment["text"], line_length)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user