Spaces:
Runtime error
Runtime error
Amir Zait
commited on
Commit
·
077c45d
1
Parent(s):
f7c2e78
fixed pipeline
Browse files
app.py
CHANGED
|
@@ -14,8 +14,7 @@ api_token = os.getenv("API_TOKEN")
|
|
| 14 |
asr_processor = AutoProcessor.from_pretrained("imvladikon/wav2vec2-xls-r-300m-hebrew")
|
| 15 |
asr_model = AutoModelForCTC.from_pretrained("imvladikon/wav2vec2-xls-r-300m-hebrew")
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
def process_audio_file(file):
|
| 21 |
data, sr = librosa.load(file)
|
|
@@ -59,7 +58,7 @@ def parse_transcription(wav_file):
|
|
| 59 |
logits = trans_model(input_values).logits
|
| 60 |
predicted_ids = torch.argmax(logits, dim=-1)
|
| 61 |
transcription = trans_processor.decode(predicted_ids[0], skip_special_tokens=True)
|
| 62 |
-
translated =
|
| 63 |
return transcription
|
| 64 |
|
| 65 |
output = gr.outputs.Textbox(label="TEXT")
|
|
|
|
| 14 |
asr_processor = AutoProcessor.from_pretrained("imvladikon/wav2vec2-xls-r-300m-hebrew")
|
| 15 |
asr_model = AutoModelForCTC.from_pretrained("imvladikon/wav2vec2-xls-r-300m-hebrew")
|
| 16 |
|
| 17 |
+
he_en_translator = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-he-en")
|
|
|
|
| 18 |
|
| 19 |
def process_audio_file(file):
|
| 20 |
data, sr = librosa.load(file)
|
|
|
|
| 58 |
logits = trans_model(input_values).logits
|
| 59 |
predicted_ids = torch.argmax(logits, dim=-1)
|
| 60 |
transcription = trans_processor.decode(predicted_ids[0], skip_special_tokens=True)
|
| 61 |
+
translated = he_en_translator(trasncription)
|
| 62 |
return transcription
|
| 63 |
|
| 64 |
output = gr.outputs.Textbox(label="TEXT")
|