Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ def translate(audio):
|
|
29 |
return transcription
|
30 |
|
31 |
def synthesise(text):
|
32 |
-
print(text)
|
33 |
inputs = tokenizer_mms(text[0], return_tensors="pt")
|
34 |
input_ids = inputs["input_ids"]
|
35 |
with torch.no_grad():
|
@@ -43,7 +43,10 @@ def speech_to_speech_translation(audio):
|
|
43 |
data_16 = librosa.resample(data_array, orig_sr=samplerate, target_sr=sampling_rate)
|
44 |
translated_text = translate(data_16)
|
45 |
synthesised_speech = synthesise(translated_text)
|
|
|
46 |
synthesised_speech = (synthesised_speech.numpy() * max_range).astype(np.int16)
|
|
|
|
|
47 |
return sampling_rate, synthesised_speech
|
48 |
|
49 |
|
|
|
29 |
return transcription
|
30 |
|
31 |
def synthesise(text):
|
32 |
+
print("text",text)
|
33 |
inputs = tokenizer_mms(text[0], return_tensors="pt")
|
34 |
input_ids = inputs["input_ids"]
|
35 |
with torch.no_grad():
|
|
|
43 |
data_16 = librosa.resample(data_array, orig_sr=samplerate, target_sr=sampling_rate)
|
44 |
translated_text = translate(data_16)
|
45 |
synthesised_speech = synthesise(translated_text)
|
46 |
+
print("max_range",max_range)
|
47 |
synthesised_speech = (synthesised_speech.numpy() * max_range).astype(np.int16)
|
48 |
+
print("sampling_rate",sampling_rate)
|
49 |
+
print("synthesised_speech",synthesised_speech)
|
50 |
return sampling_rate, synthesised_speech
|
51 |
|
52 |
|