Vihang28 commited on
Commit
7839c76
1 Parent(s): eedd58e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -80,18 +80,18 @@ def api_calling(audio_file, prompt, api_key):
80
  audio_text_res = response.json()
81
  return audio_text_res["choices"][0]["message"]["content"]
82
 
83
- def convert_to_mp3(mp4_file, mp3_file):
84
- audio = mp3_file
85
  video = VideoFileClip(mp4_file)
86
  audio = video.audio
87
- audio.write_audiofile(mp3_file)
88
 
89
  def message_and_history(audio_text,input, history, api_key):
90
  mp4_file = audio_text
91
- mp3_file = "output.mp3"
92
- convert_to_mp3(mp4_file, mp3_file)
93
  history = history or []
94
- output_text = api_calling(mp3_file,input,api_key)
95
 
96
  if len(input) == 0:
97
  input = "Speech from the video."
 
80
  audio_text_res = response.json()
81
  return audio_text_res["choices"][0]["message"]["content"]
82
 
83
+ def convert_to_mp3(mp4_file, wav_file):
84
+ audio = wav_file
85
  video = VideoFileClip(mp4_file)
86
  audio = video.audio
87
+ audio.write_audiofile(wav_file)
88
 
89
  def message_and_history(audio_text,input, history, api_key):
90
  mp4_file = audio_text
91
+ wav_file = "output.wav"
92
+ convert_to_mp3(mp4_file, wav_file)
93
  history = history or []
94
+ output_text = api_calling(wav_file,input,api_key)
95
 
96
  if len(input) == 0:
97
  input = "Speech from the video."