Spaces:
Running
Running
Update helper_function.py
Browse files- helper_function.py +0 -3
helper_function.py
CHANGED
@@ -1,9 +1,7 @@
|
|
1 |
-
|
2 |
import numpy as np
|
3 |
import torch
|
4 |
from transformers import pipeline
|
5 |
from transformers import VitsModel, VitsTokenizer
|
6 |
-
from IPython.display import Audio
|
7 |
from pathlib import Path
|
8 |
|
9 |
examples = list(Path('').glob('*mp3'))
|
@@ -21,7 +19,6 @@ target_dtype=np.int16
|
|
21 |
max_range = np.iinfo(target_dtype).max
|
22 |
|
23 |
def speech_to_speech_translation(filepath):
|
24 |
-
print(filepath)
|
25 |
translation = pipe(filepath, max_new_tokens=256, generate_kwargs={'task': 'translate'})['text']
|
26 |
|
27 |
inputs = tokenizer(translation, return_tensors="pt")
|
|
|
|
|
1 |
import numpy as np
|
2 |
import torch
|
3 |
from transformers import pipeline
|
4 |
from transformers import VitsModel, VitsTokenizer
|
|
|
5 |
from pathlib import Path
|
6 |
|
7 |
examples = list(Path('').glob('*mp3'))
|
|
|
19 |
max_range = np.iinfo(target_dtype).max
|
20 |
|
21 |
def speech_to_speech_translation(filepath):
|
|
|
22 |
translation = pipe(filepath, max_new_tokens=256, generate_kwargs={'task': 'translate'})['text']
|
23 |
|
24 |
inputs = tokenizer(translation, return_tensors="pt")
|