Update app.py
Browse files
app.py
CHANGED
@@ -61,12 +61,17 @@ def translate(audio):
|
|
61 |
translator = pipeline("translation", model=translation_models[codigo_idioma])
|
62 |
traduccion = translator(transcribe['text'])
|
63 |
else:
|
|
|
64 |
print(f"No hay un modelo de traducción disponible para el idioma detectado {codigo_idioma}")
|
|
|
65 |
|
66 |
return traduccion
|
67 |
|
68 |
def synthesise(text):
|
69 |
-
text
|
|
|
|
|
|
|
70 |
print(text)
|
71 |
inputs = vist_tokenizer(text, return_tensors="pt")
|
72 |
with torch.no_grad():
|
|
|
61 |
translator = pipeline("translation", model=translation_models[codigo_idioma])
|
62 |
traduccion = translator(transcribe['text'])
|
63 |
else:
|
64 |
+
transcribe = transcribe['text']
|
65 |
print(f"No hay un modelo de traducción disponible para el idioma detectado {codigo_idioma}")
|
66 |
+
return transcribe
|
67 |
|
68 |
return traduccion
|
69 |
|
70 |
def synthesise(text):
|
71 |
+
if isinstance(text, list):
|
72 |
+
text = text[0]['translation_text']
|
73 |
+
else:
|
74 |
+
text = text
|
75 |
print(text)
|
76 |
inputs = vist_tokenizer(text, return_tensors="pt")
|
77 |
with torch.no_grad():
|