Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ from transformers.models.whisper.tokenization_whisper import LANGUAGES
|
|
| 7 |
from transformers.pipelines.audio_utils import ffmpeg_read
|
| 8 |
|
| 9 |
model_id = "openai/whisper-large-v2"
|
| 10 |
-
device = "cuda" if torch.cuda.is_available() else "
|
| 11 |
|
| 12 |
|
| 13 |
LANGUANGE_MAP = {
|
|
@@ -62,11 +62,11 @@ LANGUANGE_MAP = {
|
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
-
model_ckpt = "barto17/language-detection-fine-tuned-on-xlm-roberta-base"
|
| 66 |
-
model = AutoModelForSequenceClassification.from_pretrained(model_ckpt)
|
| 67 |
-
tokenizer = AutoTokenizer.from_pretrained(model_ckpt)
|
| 68 |
-
|
| 69 |
def detect_language(sentence):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
tokenized_sentence = tokenizer(sentence, return_tensors='pt')
|
| 71 |
output = model(**tokenized_sentence)
|
| 72 |
predictions = torch.nn.functional.softmax(output.logits, dim=-1)
|
|
|
|
| 7 |
from transformers.pipelines.audio_utils import ffmpeg_read
|
| 8 |
|
| 9 |
model_id = "openai/whisper-large-v2"
|
| 10 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 11 |
|
| 12 |
|
| 13 |
LANGUANGE_MAP = {
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
def detect_language(sentence):
|
| 66 |
+
|
| 67 |
+
model_ckpt = "barto17/language-detection-fine-tuned-on-xlm-roberta-base"
|
| 68 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_ckpt)
|
| 69 |
+
tokenizer = AutoTokenizer.from_pretrained(model_ckpt)
|
| 70 |
tokenized_sentence = tokenizer(sentence, return_tensors='pt')
|
| 71 |
output = model(**tokenized_sentence)
|
| 72 |
predictions = torch.nn.functional.softmax(output.logits, dim=-1)
|