Spaces:
Configuration error
Configuration error
File size: 549 Bytes
38ea22f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# Import necessary libraries
import gradio as gr
from transformers import pipeline
import json
# Load the French translation pipeline
french_pipeline = pipeline("translation_en_to_fr")
# Define the app
def translate(text):
# Translate the input text using the pipeline
output = french_pipeline(text, max_length=50, truncation=True)
return output[0]['translation_text']
# Create the app interface
app = gr.Interface(fn=translate, inputs="text", outputs="text", title="English to French Text Translator")
# Launch the app
app.launch()
|