Spaces:
Sleeping
Sleeping
!pip3 install torch torchvision torchaudio | |
!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() | |