Update app.py
Browse files
app.py
CHANGED
|
@@ -36,6 +36,7 @@ def download_youtube_audio(url, output_path, preferred_quality="192"):
|
|
| 36 |
return None
|
| 37 |
|
| 38 |
# Function to transcribe audio using WhisperModel
|
|
|
|
| 39 |
def transcribe(path, model_name):
|
| 40 |
model = WhisperModel(model_name)
|
| 41 |
print(f"Reading {path}")
|
|
@@ -43,6 +44,7 @@ def transcribe(path, model_name):
|
|
| 43 |
return segments
|
| 44 |
|
| 45 |
# Function to process segments and convert them into a DataFrame
|
|
|
|
| 46 |
def process_segments(segments):
|
| 47 |
result = {}
|
| 48 |
print("Processing...")
|
|
@@ -60,6 +62,7 @@ def process_segments(segments):
|
|
| 60 |
return df
|
| 61 |
|
| 62 |
# Gradio interface functions
|
|
|
|
| 63 |
def generate_transcript(youtube_url, model_name="distil-large-v3"):
|
| 64 |
path = "downloaded_audio.mp3"
|
| 65 |
download_youtube_audio(youtube_url, path)
|
|
|
|
| 36 |
return None
|
| 37 |
|
| 38 |
# Function to transcribe audio using WhisperModel
|
| 39 |
+
@spaces.GPU(duration=120)
|
| 40 |
def transcribe(path, model_name):
|
| 41 |
model = WhisperModel(model_name)
|
| 42 |
print(f"Reading {path}")
|
|
|
|
| 44 |
return segments
|
| 45 |
|
| 46 |
# Function to process segments and convert them into a DataFrame
|
| 47 |
+
@spaces.GPU(duration=120)
|
| 48 |
def process_segments(segments):
|
| 49 |
result = {}
|
| 50 |
print("Processing...")
|
|
|
|
| 62 |
return df
|
| 63 |
|
| 64 |
# Gradio interface functions
|
| 65 |
+
@spaces.GPU(duration=120)
|
| 66 |
def generate_transcript(youtube_url, model_name="distil-large-v3"):
|
| 67 |
path = "downloaded_audio.mp3"
|
| 68 |
download_youtube_audio(youtube_url, path)
|