Update Gpt4oDemo.py
Browse files- Gpt4oDemo.py +14 -7
Gpt4oDemo.py
CHANGED
@@ -34,18 +34,25 @@ MODEL="gpt-4o"
|
|
34 |
device = "cpu"
|
35 |
batch_size = 16 # reduce if low on GPU mem
|
36 |
compute_type = "int8" # change to "int8" if low on GPU mem (may reduce accuracy)
|
|
|
|
|
|
|
|
|
|
|
37 |
max_new_tokens = 512 # Example value, adjust as needed
|
38 |
clip_timestamps = True # Example value, adjust as needed
|
39 |
hallucination_silence_threshold = 0.5 # Example value, adjust as needed
|
40 |
|
41 |
-
#
|
42 |
-
default_asr_options =
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
47 |
|
48 |
-
model = whisperx.load_model("large-v2", device, compute_type=compute_type, **default_asr_options)
|
49 |
'''
|
50 |
Video
|
51 |
'''
|
|
|
34 |
device = "cpu"
|
35 |
batch_size = 16 # reduce if low on GPU mem
|
36 |
compute_type = "int8" # change to "int8" if low on GPU mem (may reduce accuracy)
|
37 |
+
|
38 |
+
# Import the necessary components for TranscriptionOptions
|
39 |
+
from faster_whisper.transcribe import TranscriptionOptions
|
40 |
+
|
41 |
+
# Define the required arguments for TranscriptionOptions
|
42 |
max_new_tokens = 512 # Example value, adjust as needed
|
43 |
clip_timestamps = True # Example value, adjust as needed
|
44 |
hallucination_silence_threshold = 0.5 # Example value, adjust as needed
|
45 |
|
46 |
+
# Initialize TranscriptionOptions with the required arguments
|
47 |
+
default_asr_options = TranscriptionOptions(
|
48 |
+
max_new_tokens=max_new_tokens,
|
49 |
+
clip_timestamps=clip_timestamps,
|
50 |
+
hallucination_silence_threshold=hallucination_silence_threshold
|
51 |
+
)
|
52 |
+
|
53 |
+
# Load the model using whisperx.load_model
|
54 |
+
model = whisperx.load_model("large-v2", device, compute_type=compute_type)
|
55 |
|
|
|
56 |
'''
|
57 |
Video
|
58 |
'''
|