aitextvideo commited on
Commit
f95c616
·
verified ·
1 Parent(s): df5844d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load a free speech-to-text model (Whisper small)
5
+ transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-small")
6
+
7
+ def video_to_text(video_file):
8
+ # The pipeline will automatically extract audio from video
9
+ result = transcriber(video_file)
10
+ return result["text"]
11
+
12
+ # Create Gradio interface
13
+ with gr.Blocks() as demo:
14
+ gr.Markdown("# 🎥 Video to Text AI Tool\nUpload a video and get the transcription for free!")
15
+
16
+ with gr.Row():
17
+ video_input = gr.Video(label="Upload your video")
18
+ text_output = gr.Textbox(label="Transcribed Text", lines=10)
19
+
20
+ submit_btn = gr.Button("Generate Text")
21
+ submit_btn.click(fn=video_to_text, inputs=video_input, outputs=text_output)
22
+
23
+ demo.launch()