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() |