File size: 998 Bytes
f95c616
1c992db
 
 
 
 
 
 
 
466b858
f95c616
72577f4
 
 
 
 
 
 
466b858
f95c616
466b858
9108ebd
 
72577f4
9108ebd
 
67f8455
 
 
55edf28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import gradio as gr

with gr.Blocks() as demo:
    with gr.Row():
        gr.Image("logo.png", elem_id="logo", show_label=False)

    gr.Markdown("## πŸŽ₯ Video to Text Generator")
    # Your existing UI components here...
import gradio as gr
from transformers import pipeline

# Load the ASR model once (faster, avoids reloading each time)
asr = pipeline("automatic-speech-recognition", model="openai/whisper-small")

def video_to_text(video_file):
    if video_file is None:
        return "Please upload a video file."
    text = asr(video_file)["text"]
    return text

with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
    gr.Markdown("# πŸŽ₯ Video-to-Text AI Tool\nUpload a video and get the transcript instantly.")
    
    video_input = gr.Video(label="Upload Video")
    transcript_output = gr.Textbox(label="Transcript", lines=10)
    
    btn = gr.Button("Generate Transcript")
    btn.click(video_to_text, inputs=video_input, outputs=transcript_output)

demo.launch()