veni18's picture
fix
9613838
raw
history blame
473 Bytes
import gradio as gr
from transformers import pipeline
def greet(sentences1):
translation = pipeline("translation", model="Helsinki-NLP/opus-mt-en-hu")
text_translated=[]
for text in sentences1:
text_translated.append(translation(text))
combined_text = ' '.join([item['translation_text'] for sublist in text_translated for item in sublist])
return combined_text
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()