pratikshahp's picture
Create app.py
4b74d53 verified
raw
history blame
341 Bytes
import gradio as gr
from transformers import pipeline
translator = pipeline("translation_en_to_hi", model="Helsinki-NLP/opus-mt-en-hi")
def translate_text(text):
result = translator(text)[0]['translation_text']
return result
iface = gr.Interface(fn=translate_text, inputs="text", outputs="text")
# Enable API mode
iface.launch()