Ar4ikov commited on
Commit
142f6ec
1 Parent(s): 8ffa72a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -24,7 +24,7 @@ def predict(speech_array, sampling_rate):
24
  inputs = {key: inputs[key].to(device) for key in inputs}
25
 
26
  with torch.no_grad():
27
- logits = model_(**inputs).logits
28
 
29
  scores = F.softmax(logits, dim=1).detach().cpu().numpy()[0]
30
  outputs = [{"Emotion": config.id2label[i], "Score": f"{round(score * 100, 3):.1f}%"} for i, score in enumerate(scores)]
@@ -39,7 +39,6 @@ model = AutoModel.from_pretrained("Aniemore/wav2vec2-xlsr-53-russian-emotion-rec
39
  feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("Aniemore/wav2vec2-xlsr-53-russian-emotion-recognition")
40
 
41
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
42
- model.to(device)
43
 
44
 
45
  def transcribe(audio):
 
24
  inputs = {key: inputs[key].to(device) for key in inputs}
25
 
26
  with torch.no_grad():
27
+ logits = model.to(device)(**inputs).logits
28
 
29
  scores = F.softmax(logits, dim=1).detach().cpu().numpy()[0]
30
  outputs = [{"Emotion": config.id2label[i], "Score": f"{round(score * 100, 3):.1f}%"} for i, score in enumerate(scores)]
 
39
  feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("Aniemore/wav2vec2-xlsr-53-russian-emotion-recognition")
40
 
41
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
42
 
43
 
44
  def transcribe(audio):