Update app.py
Browse files
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,
|
84 |
-
audio =
|
85 |
video = VideoFileClip(mp4_file)
|
86 |
audio = video.audio
|
87 |
-
audio.write_audiofile(
|
88 |
|
89 |
def message_and_history(audio_text,input, history, api_key):
|
90 |
mp4_file = audio_text
|
91 |
-
|
92 |
-
convert_to_mp3(mp4_file,
|
93 |
history = history or []
|
94 |
-
output_text = api_calling(
|
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."
|