Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######## https://github.com/openai/whisper
- apt install pip
- apt install python3.11-venv
- mkdir project
- cd /usr/src/project/
- python3 -m venv project/
- source /usr/src/project/bin/activate
- pip install -U openai-whisper
- alternative
- pip install git+https://github.com/openai/whisper.git
- ####################################################
- touch my_whisper.py
- import whisper
- import time
- # Засекаем время начала выполнения кода
- start_time = time.time()
- ###########################################################################################
- #Size Parameters # English-only model # Multilingual model # Required # VRAM Relative speed
- #tiny 39 M # tiny.en # tiny # ~1 GB # ~32x
- #base 74 M # base.en # base # ~1 GB # ~16x
- #small 244 M # small.en # small # ~2 GB # ~6x
- #medium 769 M # medium.en # medium # ~5 GB # ~2x
- #large 1550 M # N/A # large # ~10 GB # 1x
- ##########################################################################################
- #model = whisper.load_model("tiny")
- #model = whisper.load_model("base")
- model = whisper.load_model("small")
- #model = whisper.load_model("medium")
- #model = whisper.load_model("large")
- result = model.transcribe("audio.wav")
- # Открываем файл для записи
- with open("/home/load/output.txt", "w") as file:
- file.write(result["text"])
- # Засекаем время окончания выполнения кода
- end_time = time.time()
- # Вычисляем время выполнения в секундах
- execution_time = end_time - start_time
- print(f"Результат успешно записан в файл output.txt")
- print(f"Время выполнения: {execution_time} секунд")
- ###################################################
- cd /usr/src/project
- python my_whisper.py
- ##################################################
- sudo apt update && sudo apt install ffmpeg
- deactivate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement