barto17 commited on
Commit
8299dc1
1 Parent(s): aabfdd7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -52,6 +52,17 @@ LANGUANGE_MAP = {
52
  }
53
 
54
 
 
 
 
 
 
 
 
 
 
 
 
55
  device = "cuda" if torch.cuda.is_available() else "CPU"
56
 
57
  model_ckpt = "barto17/language-detection-fine-tuned-on-xlm-roberta-base"
 
52
  }
53
 
54
 
55
+ processor = WhisperProcessor.from_pretrained(model_id)
56
+ model = WhisperForConditionalGeneration.from_pretrained(model_id)
57
+ model.eval()
58
+ model.to(device)
59
+
60
+ sampling_rate = processor.feature_extractor.sampling_rate
61
+
62
+ bos_token_id = processor.tokenizer.all_special_ids[-106]
63
+ decoder_input_ids = torch.tensor([bos_token_id]).to(device)
64
+
65
+
66
  device = "cuda" if torch.cuda.is_available() else "CPU"
67
 
68
  model_ckpt = "barto17/language-detection-fine-tuned-on-xlm-roberta-base"