File size: 504 Bytes
24ddb11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
import transformers

def translate_with_prefix(English):
    prefix = "Translate English to Latin: "
    translator = transformers.pipeline("translation", model="AlbertY123/translator-en-la") 
    return translator(prefix + English)

iface = gr.Interface(fn=translate_with_prefix, 
                     inputs="text", 
                     outputs="text"
                     , title="English to Latin Translator"
                    )

if __name__ == "__main__":
    iface.launch()