adiv07 commited on
Commit
c02df54
·
verified ·
1 Parent(s): 6a981b2

Update Gpt4oDemo.py

Browse files
Files changed (1) hide show
  1. 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
- # Load the model with the required arguments
42
- default_asr_options = {
43
- "max_new_tokens": max_new_tokens,
44
- "clip_timestamps": clip_timestamps,
45
- "hallucination_silence_threshold": hallucination_silence_threshold
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
  '''