Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
import torch
|
2 |
import torchaudio
|
3 |
-
from transformers import
|
4 |
|
5 |
-
|
6 |
-
model =
|
7 |
|
8 |
def speech_file_to_array_fn(path, sampling_rate):
|
9 |
speech_array, _sampling_rate = torchaudio.load(path)
|
@@ -24,7 +24,7 @@ def predict(path, sampling_rate):
|
|
24 |
return outputs
|
25 |
|
26 |
def SER(Audio):
|
27 |
-
return predict(Audio,
|
28 |
|
29 |
iface = gr.Interface(fn=SER, inputs="audio", outputs="text")
|
30 |
iface.launch(share=False)
|
|
|
1 |
import torch
|
2 |
import torchaudio
|
3 |
+
from transformers import Wav2Vec2FeatureExtractor,AutoConfig,pipeline
|
4 |
|
5 |
+
config = AutoConfig.from_pretrained("SeyedAli/Persian-Speech-Emotion-HuBert-V1")
|
6 |
+
model = Wav2Vec2FeatureExtractor.from_pretrained("SeyedAli/Persian-Speech-Emotion-HuBert-V1")
|
7 |
|
8 |
def speech_file_to_array_fn(path, sampling_rate):
|
9 |
speech_array, _sampling_rate = torchaudio.load(path)
|
|
|
24 |
return outputs
|
25 |
|
26 |
def SER(Audio):
|
27 |
+
return predict(Audio,model.sampling_rate)
|
28 |
|
29 |
iface = gr.Interface(fn=SER, inputs="audio", outputs="text")
|
30 |
iface.launch(share=False)
|