Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,8 +37,14 @@ def parse(wav_file):
|
|
| 37 |
input_values = read_file_and_process(wav_file)
|
| 38 |
with torch.no_grad():
|
| 39 |
logits = model(**input_values).logits
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
model_id = "jonatasgrosman/wav2vec2-large-xlsr-53-persian"
|
| 44 |
processor = Wav2Vec2Processor.from_pretrained(model_id)
|
|
|
|
| 37 |
input_values = read_file_and_process(wav_file)
|
| 38 |
with torch.no_grad():
|
| 39 |
logits = model(**input_values).logits
|
| 40 |
+
sentence = parse_transcription(logits)
|
| 41 |
+
check_spell = spell_checker.check(sentence)
|
| 42 |
+
if check_spell[0] is False:
|
| 43 |
+
sentence = sentence
|
| 44 |
+
elif check_spell[0] is True:
|
| 45 |
+
sentence = check_spell[1]
|
| 46 |
+
return sentence
|
| 47 |
+
|
| 48 |
|
| 49 |
model_id = "jonatasgrosman/wav2vec2-large-xlsr-53-persian"
|
| 50 |
processor = Wav2Vec2Processor.from_pretrained(model_id)
|