File size: 758 Bytes
9a4dd2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr

from src.translation.translate import translate

LANGS = ["arabic", "english"]

if __name__ == "__main__":
    # Create the Gradio interface
    iface = gr.Interface(
        fn=translate,
        inputs=[
            gr.components.Textbox(label="Text"),
            gr.components.Dropdown(label="Source Language", choices=LANGS),
            gr.components.Dropdown(label="Target Language", choices=LANGS),
        ],
        outputs=["text"],
        examples=[["I'm ready", "english", "arabic"]],
        cache_examples=False,
        title="arabic2english",
        description="This is a translator app for arabic and english. Currently supports only english to arabic."
    )

    # Launch the interface
    iface.launch(share=True)