File size: 521 Bytes
8840325
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
import subprocess
import os

def videoxsub(vid):
    getAudio(vid)
    getSubs()
    return [vid, "audio.vtt"]

def getAudio(vid):
    if os.path.exists("audio.mp3"):
        os.remove("audio.mp3")
    commands_list = [ "ffmpeg", "-i", vid, "audio.mp3" ]
    subprocess.run(commands_list)

def getSubs():
    command_list = [ "whisper", "audio.mp3", "-f", "vtt", "--fp16", "False"]
    subprocess.run(command_list)
   
demo = gr.Interface(fn=videoxsub, inputs="video", outputs="video")

demo.launch()