Spaces:
Sleeping
Sleeping
File size: 416 Bytes
ce08e95 50ac962 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
!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()
|