aitextvideo commited on
Commit
466b858
·
verified ·
1 Parent(s): ab8e7c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -1,24 +1,25 @@
1
  import gradio as gr
2
- import whisper
3
 
4
- # Load Whisper model
5
- model = whisper.load_model("base")
6
 
7
  # Function to convert video to text
8
  def video_to_text(video):
9
- result = model.transcribe(video)
10
- return result["text"]
 
11
 
12
- with gr.Blocks() as demo:
13
  gr.Markdown(
14
  """
15
- <h1 style='text-align: center; color: #2E86C1;'>🎥 Video-to-Text AI Tool</h1>
16
- <p style='text-align: center;'>Convert your videos into text transcripts in seconds — powered by OpenAI's Whisper.</p>
17
- <hr>
18
- <b>How to use:</b><br>
19
- 1. Upload your video file (MP4, MOV, MKV, etc.)<br>
20
- 2. Wait for processing (time depends on length)<br>
21
- 3. Copy or download your transcript.
22
  """
23
  )
24
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # Load Hugging Face's hosted Whisper model (small, fast)
5
+ asr = pipeline("automatic-speech-recognition", model="openai/whisper-small")
6
 
7
  # Function to convert video to text
8
  def video_to_text(video):
9
+ # Hugging Face pipeline can take audio from video
10
+ text = asr(video)["text"]
11
+ return text
12
 
13
+ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
14
  gr.Markdown(
15
  """
16
+ # 🎥 Video-to-Text AI Tool
17
+ Convert your videos into text transcripts in **seconds** — powered by Hugging Face Whisper.
18
+ ---
19
+ **Steps:**
20
+ 1. Upload a short video (MP4, MOV, MKV, etc.).
21
+ 2. Click **Generate Transcript**.
22
+ 3. Copy your transcript.
23
  """
24
  )
25