Vihang28 commited on
Commit
b5612b3
·
verified ·
1 Parent(s): 7d239c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -80,12 +80,15 @@ 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
-
 
 
 
84
 
85
  def message_and_history(audio_text,input, history, api_key):
 
86
  mp3_file = "output.mp3"
87
- audio = audio_text.audio
88
- audio.write_audiofile(mp3_file)
89
  history = history or []
90
  output_text = api_calling(mp3_file,input,api_key)
91
 
 
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
+ video = VideoFileClip(mp4_file)
85
+ audio = video.audio
86
+ audio.write_audiofile(mp3_file)
87
 
88
  def message_and_history(audio_text,input, history, api_key):
89
+ mp4_file = audio_text
90
  mp3_file = "output.mp3"
91
+ convert_to_mp3(mp4_file, mp3_file)
 
92
  history = history or []
93
  output_text = api_calling(mp3_file,input,api_key)
94