test_python / libs /transformer /get_transcript_2.py
minhpng's picture
add transformer get transcript
c5bb903
raw
history blame
454 Bytes
from transformers import pipeline
def get_transcribe_transformers(url:str):
pipe = pipeline("automatic-speech-recognition", model="distil-whisper/distil-large-v3", return_timestamps=True)
result = pipe(url)
return result.get("text"), result.get("chunks")
text, chunks = get_transcribe_transformers("https://static.langkingdom.com/user_playlist_practice_videos/0a871d06c1e8e1174da09d5aad6ec550.x-m4a")
print(chunks[0].get("timestamp")[1])