Spaces:
Sleeping
Sleeping
Update inference.py
Browse files- inference.py +5 -2
inference.py
CHANGED
@@ -273,11 +273,14 @@ def main(video_path):
|
|
273 |
|
274 |
# Summarize using Groq API
|
275 |
client = Groq(api_key=groq_key)
|
276 |
-
|
|
|
|
|
|
|
277 |
|
278 |
# Text to speech
|
279 |
tts_path = "commentary_final.mp3"
|
280 |
-
text_to_speech(clean_commentary, tts_path,
|
281 |
|
282 |
short_audio_path = "pro_audio3.mp3"
|
283 |
os.system(f"ffmpeg -y -i {tts_path} -ss 0 -t 3 {short_audio_path}")
|
|
|
273 |
|
274 |
# Summarize using Groq API
|
275 |
client = Groq(api_key=groq_key)
|
276 |
+
video = VideoFileClip(video_path)
|
277 |
+
video_duration = video.duration # in seconds
|
278 |
+
tts_speed = 1.3 # adjust as needed
|
279 |
+
clean_commentary = summarize_commentary(raw_commentary, client, video_duration, tts_speed)
|
280 |
|
281 |
# Text to speech
|
282 |
tts_path = "commentary_final.mp3"
|
283 |
+
text_to_speech(clean_commentary, tts_path, tts_speed)
|
284 |
|
285 |
short_audio_path = "pro_audio3.mp3"
|
286 |
os.system(f"ffmpeg -y -i {tts_path} -ss 0 -t 3 {short_audio_path}")
|