File size: 440 Bytes
eb59b63
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gradio as gr
from transformers import pipeline

# Define the model path in Hugging Face
model_name = "willco-afk/languages"  # Ensure this is correct for your uploaded model
translator = pipeline("translation", model=model_name)

def translate(input_text):
    return translator(input_text)[0]['translation_text']

# Define Gradio Interface
iface = gr.Interface(fn=translate, inputs="text", outputs="text", live=True)

iface.launch()