Логово Комара: post #536 — TG.ME

Перевод аудио в текст с помощью нейронной сети📌

Часть 1. Загрузка модели и аудио файла

#Importing the necessary libraries
import torch
import whisper
import pytube
import librosa
import matplotlib.pyplot as plt
import numpy as np
import IPython.display as ipd

#Loading the Model

model_m = whisper.load_model('medium')

#Loading the file
# вставьте сюда ваш файл

file_path = '/content/Rec.mp3'

#Loading
audio_13 = whisper.load_audio(file_path)
audio_13

#Задаем время голосовго файла - 12 секунд
T = 12
#Checking the number of samples in our audio file
n_samples = audio_13.shape[0]
#Time between samples
delta = T/n_samples
#Sampling frequency
Fs = 1/delta
#Time of each sample
time = np.linspace(0,(n_samples-1) * delta,n_samples)
time

#Now we plot the amplitude with respect to time:

plt.figure(figsize=(20,10))
plt.title('Signal')
plt.plot(time,audio_13)
plt.ylabel('amplitude')
plt.xlabel('seconds')
plt.show()
👍3🔥2❤1
December 18, 2024 1.5K 14