aichina commited on
Commit
d834007
1 Parent(s): e0aae73
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -57,18 +57,20 @@ def convert(res):
57
 
58
 
59
  def get_audio(url):
60
- print(f'{url} start get audio ...')
61
  yt = YouTube(url)
62
- audio_file = yt.streams.filter(only_audio=True)[0].download(filename="tmp.mp4")
 
 
63
  print('aodio over ..')
64
  return audio_file
65
 
66
  def get_transcript(url):
67
  audio_file = get_audio(url)
68
- audio_file = 'tmp.mp4'
69
  files = {
70
  'audio': (f"{audio_file}", open(f'{audio_file}', 'rb'), 'video/mp4'),
71
- 'audio_url': (None, 'http://files.gladia.io/example/audio-transcription/split_infinity.wav'),
72
  'language': (None, 'english'),
73
  'language_behaviour': (None, 'automatic single language'),
74
  }
 
57
 
58
 
59
  def get_audio(url):
60
+
61
  yt = YouTube(url)
62
+ audio_file = f'{random.randint(10000,100000)}.mp4'
63
+ print(f'{url} {audio_file} start get audio ...')
64
+ yt.streams.filter(only_audio=True)[0].download(filename=audio_file)
65
  print('aodio over ..')
66
  return audio_file
67
 
68
  def get_transcript(url):
69
  audio_file = get_audio(url)
70
+ # audio_file = 'tmp.mp4'
71
  files = {
72
  'audio': (f"{audio_file}", open(f'{audio_file}', 'rb'), 'video/mp4'),
73
+ 'audio_url': (None, ''),
74
  'language': (None, 'english'),
75
  'language_behaviour': (None, 'automatic single language'),
76
  }