Spaces:
Running
Running
metadata
title: YoutubeTranscriptTool
emoji: 💬
colorFrom: green
colorTo: pink
sdk: gradio
sdk_version: 5.12.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: Transcribe Youtube Video
YouTube Transcript SmolAgent Tool
Overview
This is a tool to fetch transcripts for YouTube videos. It attempts to retrieve the official YouTube transcript first, and if that fails or if the user opts to skip it, it falls back to using Whisper ASR to transcribe the audio.
Project Structure
app.py
: Main application file that sets up the Gradio interface and handles the transcript fetching logic.transcription.py
: Contains functions for downloading audio, converting it to WAV format, and transcribing it using Whisper ASR.youtube_utils.py
: Contains utility functions for extracting video IDs and fetching official YouTube transcripts.logging_config.py
: Configures logging for the application.ffmpeg_setup.py
: Ensures thatffmpeg
is available in the system path.
Dependencies
- Python
- pip
- Gradio
- yt-dlp
- torch
- transformers
- youtube_transcript_api
- ffmpeg
How It Works
- User Input: The user provides a YouTube URL and optionally chooses to skip the official transcript check.
- Transcript Fetching:
- If the user opts to skip the official transcript, the tool directly uses Whisper ASR to transcribe the audio.
- Otherwise, it first attempts to fetch the official YouTube transcript.
- If the official transcript is not found, it falls back to using Whisper ASR.
- Whisper ASR:
- Downloads the best audio track using
yt-dlp
. - Converts the audio to WAV format using
ffmpeg
. - Transcribes the audio using the Whisper ASR model from the
transformers
library.
- Downloads the best audio track using
- Output: The transcript and logs are displayed in the Gradio interface.
Running the Application
- Ensure you have all dependencies installed:
pip install gradio yt-dlp torch transformers youtube_transcript_api
- Run the application:
python app.py
- Open the provided URL in your browser to access the Gradio interface.