Translator / app.py
pallabi's picture
Update app.py
ce08e95 verified
raw
history blame
416 Bytes
!pip install torch
!pip install transformers gradio --upgrade
import gradio as gr
from transformers import pipeline
translation = pipeline('translation_en_to_fr')
def translate(from_text):
result = translation(from_text)[0]['translation_text']
return result
interface = gr.Interface(fn = translate , inputs = gr.Textbox(lines=2 , placeholder="text to translate") , outputs="text" )
interface.launch()