json-cache whisper transcription
This commit is contained in:
@@ -4,6 +4,8 @@ usage = 'python transcribe-voice-track.py <fountain filename> <character> <wav f
|
||||
|
||||
import util
|
||||
from imports import *
|
||||
import json
|
||||
from os.path import exists
|
||||
|
||||
import whisper
|
||||
model = whisper.load_model("turbo")
|
||||
@@ -80,7 +82,15 @@ map = fmap.map
|
||||
print(map)
|
||||
|
||||
for audio_filename in audio_filenames:
|
||||
result = model.transcribe(audio_filename)
|
||||
result = None
|
||||
if exists(f'{audio_filename}.json'):
|
||||
with open(f'{audio_filename}.json', 'r') as f:
|
||||
result = json.load(f)
|
||||
else:
|
||||
result = model.transcribe(audio_filename)
|
||||
with open(f'{audio_filename}.json', 'w') as f:
|
||||
json.dump(result, f)
|
||||
|
||||
print(result['segments'])
|
||||
for segment in result['segments']:
|
||||
match = fmap.best_match(segment['text'])
|
||||
|
Reference in New Issue
Block a user