Eason Lu commited on
Commit
97dba4f
·
1 Parent(s): 164a372

modify script split

Browse files

Former-commit-id: 799cf8f91e4b3e0bac38800b8ef89760b5630cf4

Files changed (2) hide show
  1. .gitignore +2 -1
  2. pipeline.py +2 -6
.gitignore CHANGED
@@ -1,3 +1,4 @@
1
  /downloads
2
  /results
3
- .DS_Store
 
 
1
  /downloads
2
  /results
3
+ .DS_Store
4
+ /__pycache__
pipeline.py CHANGED
@@ -2,9 +2,7 @@ import openai
2
  from pytube import YouTube
3
  import argparse
4
  import os
5
- import io
6
  import whisper
7
- import ffmpeg
8
  from tqdm import tqdm
9
 
10
  parser = argparse.ArgumentParser()
@@ -66,14 +64,12 @@ if args.link is not None and args.video_file is None:
66
  exit()
67
 
68
  video_path = f'{DOWNLOAD_PATH}/video/{video.default_filename}'
69
- # video_file = open(video_path, "rb")
70
  audio_path = '{}/audio/{}'.format(DOWNLOAD_PATH, audio.default_filename)
71
  audio_file = open(audio_path, "rb")
72
  if VIDEO_NAME == 'placeholder':
73
  VIDEO_NAME = audio.default_filename.split('.')[0]
74
  elif args.video_file is not None:
75
  # Read from local
76
- # video_file = open(args.video_file, "rb")
77
  video_path = args.video_file
78
  if args.audio_file is not None:
79
  audio_file= open(args.audio_file, "rb")
@@ -120,8 +116,8 @@ if not args.only_srt:
120
  print('ASS subtitle saved as: ' + assSub_en)
121
 
122
  # Split the video script by sentences and create chunks within the token limit
123
- n_threshold = 1500 # Token limit for the GPT-3 model
124
- script_split = script_input.split('.')
125
 
126
  script_arr = []
127
  script = ""
 
2
  from pytube import YouTube
3
  import argparse
4
  import os
 
5
  import whisper
 
6
  from tqdm import tqdm
7
 
8
  parser = argparse.ArgumentParser()
 
64
  exit()
65
 
66
  video_path = f'{DOWNLOAD_PATH}/video/{video.default_filename}'
 
67
  audio_path = '{}/audio/{}'.format(DOWNLOAD_PATH, audio.default_filename)
68
  audio_file = open(audio_path, "rb")
69
  if VIDEO_NAME == 'placeholder':
70
  VIDEO_NAME = audio.default_filename.split('.')[0]
71
  elif args.video_file is not None:
72
  # Read from local
 
73
  video_path = args.video_file
74
  if args.audio_file is not None:
75
  audio_file= open(args.audio_file, "rb")
 
116
  print('ASS subtitle saved as: ' + assSub_en)
117
 
118
  # Split the video script by sentences and create chunks within the token limit
119
+ n_threshold = 1000 # Token limit for the GPT-3 model
120
+ script_split = script_input.split('\n')
121
 
122
  script_arr = []
123
  script = ""