Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
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")
|
@@ -13,7 +14,7 @@ def speech_file_to_array_fn(path, sampling_rate):
|
|
13 |
|
14 |
def predict(path, sampling_rate):
|
15 |
speech = speech_file_to_array_fn(path, sampling_rate)
|
16 |
-
inputs =
|
17 |
inputs = {key: inputs[key].to(device) for key in inputs}
|
18 |
|
19 |
with torch.no_grad():
|
|
|
1 |
import torch
|
2 |
import torchaudio
|
3 |
+
import gradio as gr
|
4 |
from transformers import Wav2Vec2FeatureExtractor,AutoConfig,pipeline
|
5 |
|
6 |
config = AutoConfig.from_pretrained("SeyedAli/Persian-Speech-Emotion-HuBert-V1")
|
|
|
14 |
|
15 |
def predict(path, sampling_rate):
|
16 |
speech = speech_file_to_array_fn(path, sampling_rate)
|
17 |
+
inputs = model(speech, sampling_rate=sampling_rate, return_tensors="pt", padding=True)
|
18 |
inputs = {key: inputs[key].to(device) for key in inputs}
|
19 |
|
20 |
with torch.no_grad():
|