Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# Load English-to-Japanese translation pipeline | |
translator = pipeline("translation", model="staka/fugumt-en-ja") | |
# Define translation function | |
def translate(text): | |
if not text.strip(): | |
return "Please enter some English text." | |
result = translator(text)[0]["translation_text"] | |
return result | |
# Create Gradio interface | |
gr.Interface(fn=translate, inputs="text", outputs="text").launch() | |