Spaces:
Build error

File size: 600 Bytes
2457575
f28681b
2457575
2486d01
 
2457575
c2fd2b3
 
 
 
 
f28681b
 
c2fd2b3
f28681b
 
2486d01
 
f28681b
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from transformers import pipeline

# Load the translation pipeline with a specific model
translation_pipeline = pipeline("translation_en_to_hi", model="Helsinki-NLP/opus-mt-en-hi")

def translate_text(text):
    # Use the pipeline to translate the text
    translation = translation_pipeline(text)
    # Return the translated text
    return translation[0]["translation_text"]

demo = gr.Interface(
    fn=translate_text,
    inputs="text",
    outputs="text",
    title="English to Hindi Translator",
    description="Enter English text to translate it to Hindi"
)

demo.launch()