Spaces:
Running
Running
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() | |