Update audio2text/a2t.py
Browse files- audio2text/a2t.py +4 -0
audio2text/a2t.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import librosa
|
2 |
import torch
|
3 |
from .init import processor, model
|
@@ -7,6 +9,7 @@ LIMIT = 90 # limit 90 seconds
|
|
7 |
class A2T:
|
8 |
def __init__(self, mic):
|
9 |
self.mic = mic
|
|
|
10 |
|
11 |
def __preprocces(self, audio, frame_rate):
|
12 |
try:
|
@@ -29,6 +32,7 @@ class A2T:
|
|
29 |
def predict(self):
|
30 |
if self.mic is not None:
|
31 |
audio = self.mic.get_array_of_samples()
|
|
|
32 |
frame_rate = self.mic.frame_rate
|
33 |
else:
|
34 |
return "please provide audio"
|
|
|
1 |
+
import numpy as np
|
2 |
+
|
3 |
import librosa
|
4 |
import torch
|
5 |
from .init import processor, model
|
|
|
9 |
class A2T:
|
10 |
def __init__(self, mic):
|
11 |
self.mic = mic
|
12 |
+
print(type(self.mic))
|
13 |
|
14 |
def __preprocces(self, audio, frame_rate):
|
15 |
try:
|
|
|
32 |
def predict(self):
|
33 |
if self.mic is not None:
|
34 |
audio = self.mic.get_array_of_samples()
|
35 |
+
audio = np.array(audio)
|
36 |
frame_rate = self.mic.frame_rate
|
37 |
else:
|
38 |
return "please provide audio"
|