Update app.py
Browse files
app.py
CHANGED
@@ -12,14 +12,7 @@ def transcribe(audio_file):
|
|
12 |
# Transcribe with original Whisper
|
13 |
model = whisper.load_model("large", device)
|
14 |
result = model.transcribe(audio_file)
|
15 |
-
|
16 |
-
# Load alignment model and metadata
|
17 |
-
model_a, metadata = whisperx.load_align_model(language_code=result["language"], device=device)
|
18 |
-
|
19 |
-
# Align Whisper output
|
20 |
-
result_aligned = whisperx.align(result["segments"], model_a, metadata, audio_file, device)
|
21 |
-
|
22 |
-
return {"aligned": result_aligned["segments"], "word_segments": result_aligned["word_segments"]}
|
23 |
|
24 |
inputs = gr.Audio(sources="upload", type="filepath")
|
25 |
outputs = gr.JSON()
|
|
|
12 |
# Transcribe with original Whisper
|
13 |
model = whisper.load_model("large", device)
|
14 |
result = model.transcribe(audio_file)
|
15 |
+
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
inputs = gr.Audio(sources="upload", type="filepath")
|
18 |
outputs = gr.JSON()
|