-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: revamp code structure #37
Conversation
let's fix flake8 linting? |
@@ -198,7 +194,7 @@ def yt_download(video_id): | |||
exception = e | |||
|
|||
return jsonify({"message": log_error_return_str( | |||
f'An error occurred while downloading video {video_id} to {video_save_path}: {exception}')}), 500 | |||
f'An error occurred while downloading video {video_id} to {video_save_path}: {exception}')}), 500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: extra space
en_srt_merged_fn = f'{video_id}_en_merged.srt' | ||
zh_srt_merged_fn = f'{video_id}_zh_merged.srt' | ||
en_srt_merged_path = os.path.join(output_path, en_srt_merged_fn) | ||
zh_srt_merged_path = os.path.join(output_path, zh_srt_merged_fn) | ||
data = request.get_json() | ||
video_id = data['video_id'] | ||
translateVendor = data['translate_vendor'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/translaterVendor/translator_vendor
app.py
Outdated
@@ -583,7 +546,8 @@ def tts(video_id): | |||
shutil.rmtree(tts_dir) | |||
|
|||
try: | |||
ret = srtToVoiceEdge(app.logger, srt_path, tts_dir, charater) | |||
tts_client = get_tts_client(charater) | |||
ret = tts_client.srt_to_voice(srt_path, tts_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice abstraction of TTS client
"audio zh transcribe": true, | ||
"audio zh transcribe model": "medium", | ||
"video zh preview": true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit extra space
"proxy": "127.0.0.1:7890", | ||
"video Id": "eMlx5fFNoYc", | ||
"work path": "conver\\cheak_valve", | ||
"download video": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert those keys to underscore naming conventions
@@ -6,7 +6,7 @@ | |||
from tqdm import tqdm | |||
|
|||
try: | |||
from lib import spec_utils | |||
from models.audio_removal_model import spec_utils | |||
except ModuleNotFoundError: | |||
import spec_utils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of try
|
||
DEFAULT_URL = "https://api.openai.com/v1/" | ||
GHATGPT_TERMS_FILE = "../../../configs/gpt_terms.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use os join from project root
@@ -3,21 +3,20 @@ | |||
import concurrent.futures | |||
import time | |||
import tenacity | |||
from .translator import Translator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
svc.service.translator use full path
@@ -0,0 +1,484 @@ | |||
# from src.service.audio_processing.audio_remove import audio_remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remove
This PR contains following changes