File size: 307 Bytes
71402dd
 
9ab1399
71402dd
 
 
9ab1399
71402dd
9ab1399
 
 
 
71402dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gradio as gr
import torch
from transformers import pipeline

print(f'{torch.cuda.is_available()=}')

pipe = pipeline('translation_en_to_fr', device=0)

def translate(text):
    return pipe(text)[0]['translation_text']

iface = gr.Interface(fn=translate, inputs="text", outputs="text")
iface.launch()