arabic2english / app.py
alifalhasan's picture
[Task] Model Deployment
9a4dd2c verified
raw
history blame
758 Bytes
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)