Spaces:
Running
Running
File size: 688 Bytes
606a773 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from transformers import pipeline
# Load the translation pipeline
translator = pipeline("translation_en_to_fr", model="AventIQ-AI/t5-text-translator")
def translate(text):
result = translator(text)
return result[0]['translation_text']
# Create Gradio interface
iface = gr.Interface(
fn=translate,
inputs=gr.Textbox(lines=5, placeholder="Enter English text here..."),
outputs=gr.Textbox(label="Translated French Text"),
title="English to French Translator",
description="Translate English text into French using the T5 model fine-tuned by AventIQ.",
)
# Launch the app
if __name__ == "__main__":
iface.launch()
|