Skip to content
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

Merged
merged 18 commits into from
Jul 22, 2024
Merged

feat: revamp code structure #37

merged 18 commits into from
Jul 22, 2024

Conversation

JimmyZhangJW
Copy link
Collaborator

@JimmyZhangJW JimmyZhangJW commented Jul 21, 2024

This PR contains following changes

  • Multi-stage dockerfile to make build faster
  • Major code structure revamp and refactoring

@HanFa
Copy link
Contributor

HanFa commented Jul 21, 2024

let's fix flake8 linting?

HanFa
HanFa previously approved these changes Jul 21, 2024
@@ -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
Copy link
Contributor

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']
Copy link
Contributor

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)
Copy link
Contributor

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
}
Copy link
Contributor

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,
Copy link
Contributor

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
Copy link
Contributor

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"
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove

@HanFa HanFa self-requested a review July 22, 2024 02:28
@HanFa HanFa merged commit 6e0953b into master Jul 22, 2024
2 checks passed
@HanFa HanFa deleted the feat/revamp_structure branch July 22, 2024 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants