Spaces:
Running
Running
jhj0517
commited on
Commit
·
cdb03d3
1
Parent(s):
531f396
add typing
Browse files
modules/faster_whisper_inference.py
CHANGED
|
@@ -3,7 +3,7 @@ import os
|
|
| 3 |
import tqdm
|
| 4 |
import time
|
| 5 |
import numpy as np
|
| 6 |
-
from typing import BinaryIO, Union, Tuple
|
| 7 |
from datetime import datetime, timedelta
|
| 8 |
|
| 9 |
import faster_whisper
|
|
@@ -312,7 +312,7 @@ class FasterWhisperInference(BaseInterface):
|
|
| 312 |
log_prob_threshold: float,
|
| 313 |
no_speech_threshold: float,
|
| 314 |
progress: gr.Progress
|
| 315 |
-
) -> Tuple[
|
| 316 |
"""
|
| 317 |
transcribe method for faster-whisper.
|
| 318 |
|
|
|
|
| 3 |
import tqdm
|
| 4 |
import time
|
| 5 |
import numpy as np
|
| 6 |
+
from typing import BinaryIO, Union, Tuple, List
|
| 7 |
from datetime import datetime, timedelta
|
| 8 |
|
| 9 |
import faster_whisper
|
|
|
|
| 312 |
log_prob_threshold: float,
|
| 313 |
no_speech_threshold: float,
|
| 314 |
progress: gr.Progress
|
| 315 |
+
) -> Tuple[List[dict], float]:
|
| 316 |
"""
|
| 317 |
transcribe method for faster-whisper.
|
| 318 |
|
modules/whisper_Inference.py
CHANGED
|
@@ -2,7 +2,7 @@ import whisper
|
|
| 2 |
import gradio as gr
|
| 3 |
import time
|
| 4 |
import os
|
| 5 |
-
from typing import BinaryIO, Union, Tuple
|
| 6 |
import numpy as np
|
| 7 |
from datetime import datetime
|
| 8 |
import torch
|
|
@@ -302,7 +302,7 @@ class WhisperInference(BaseInterface):
|
|
| 302 |
no_speech_threshold: float,
|
| 303 |
compute_type: str,
|
| 304 |
progress: gr.Progress
|
| 305 |
-
) -> Tuple[
|
| 306 |
"""
|
| 307 |
transcribe method for OpenAI's Whisper implementation.
|
| 308 |
|
|
@@ -331,7 +331,7 @@ class WhisperInference(BaseInterface):
|
|
| 331 |
|
| 332 |
Returns
|
| 333 |
----------
|
| 334 |
-
segments_result:
|
| 335 |
list of dicts that includes start, end timestamps and transcribed text
|
| 336 |
elapsed_time: float
|
| 337 |
elapsed time for transcription
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import time
|
| 4 |
import os
|
| 5 |
+
from typing import BinaryIO, Union, Tuple, List
|
| 6 |
import numpy as np
|
| 7 |
from datetime import datetime
|
| 8 |
import torch
|
|
|
|
| 302 |
no_speech_threshold: float,
|
| 303 |
compute_type: str,
|
| 304 |
progress: gr.Progress
|
| 305 |
+
) -> Tuple[List[dict], float]:
|
| 306 |
"""
|
| 307 |
transcribe method for OpenAI's Whisper implementation.
|
| 308 |
|
|
|
|
| 331 |
|
| 332 |
Returns
|
| 333 |
----------
|
| 334 |
+
segments_result: List[dict]
|
| 335 |
list of dicts that includes start, end timestamps and transcribed text
|
| 336 |
elapsed_time: float
|
| 337 |
elapsed time for transcription
|