Noobjay's picture
Update app.py
47ae813 verified
Raw History Blame Contribute Delete
1.32 kB
import gradio as gr
from transformers import pipeline
# Load Tagalog to English model
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-tl-en")
# Translation function
def translate_tl_en(text):
result = translator(text)[0]['translation_text']
return result
# App layout
with gr.Blocks(css="body { background-color: white; }") as app:
# Running marquee with black text
gr.HTML("""
<marquee scrollamount="5" style="color: black; font-size: 18px; font-weight: bold; margin-bottom: 10px;">
πŸ”€ Tagalog to English Translator | Created by Niko Jay Sedan with help from AI | Powered by Hugging Face | Fast, Free & Online!
</marquee>
""")
# Header and description
gr.Markdown("## 🌐 Tagalog to English AI Translator")
gr.Markdown("This free online tool translates Tagalog text to English using artificial intelligence. Built by **Niko Jay Sedan** with the help of **Hugging Face AI models**. No API key required.")
# Input/Output fields
textbox_input = gr.Textbox(lines=2, label="πŸ“ Tagalog Text")
textbox_output = gr.Textbox(label="βœ… English Translation")
# Button
translate_btn = gr.Button("Translate Now")
translate_btn.click(translate_tl_en, inputs=textbox_input, outputs=textbox_output)
# Launch the app
app.launch()