deeplx / app.py
Beyou8778's picture
Create app.py
55abb2b verified
Raw History Blame Contribute Delete
743 Bytes
import gradio as gr
def translate_demo(text, target_lang):
if not text.strip():
return "Vui lòng nhập văn bản cần dịch."
return f"[Demo Client-side] Văn bản '{text}' chuẩn bị gửi tới DeepLX API ({target_lang})."
with gr.Blocks(title="DeepLX Lite Server") as demo:
gr.Markdown("# 🚀 DeepLX Static Client / Proxy")
with gr.Row():
inp_text = gr.Textbox(label="Văn bản", placeholder="Nhập văn bản...")
lang_select = gr.Dropdown(["VI", "EN", "ZH", "JA"], value="VI", label="Ngôn ngữ đích")
btn = gr.Button("Dịch thử")
out_text = gr.Textbox(label="Kết quả")
btn.click(fn=translate_demo, inputs=[inp_text, lang_select], outputs=out_text)
demo.launch()