cuneytkaya's picture
Update app.py
39e8960 verified
raw
history blame
733 Bytes
import gradio as gr
from transformers import pipeline
import torch
translator = pipeline(
task="translation",
model="facebook/nllb-200-distilled-600M"
)
def translate_text(text):
translated = translator(text, src_lang="eng_Latn", tgt_lang="tur_Latn")
return translated[0]['translation_text']
demo = gr.Interface(
fn=translate_text,
inputs=gr.Textbox(label="Input Text (English)"),
outputs=gr.Textbox(label="Translated Text (Turkish)"),
title="English to Turkish Translator",
description="A demo that translates English text to Turkish using the NLLB-200 model.",
examples=[["What are you doing?"], ["Where should we time travel to?"], ["Let's translate me!"]],
)
demo.launch(share=True)