Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| pipe = pipeline("translation", model="fubuki119/opus-mt-en-hi") | |
| title = "English to Hindi Translator" | |
| description = """ | |
| This model is fine-tuned version of <a href="https://huggingface.co/Helsinki-NLP/opus-mt-en-hi">Helsinki-NLP/opus-mt-en-hi</a> model on | |
| <a href="https://huggingface.co/datasets/cfilt/iitb-english-hindi"> iitb-english-hindi </a> dataset. | |
| <img src="https://github.com/VaruN-dev-dev/Machine-Translation/blob/master/images/app_image.png" width=200px> | |
| """ | |
| def generate(text): | |
| hi_sen = pipe(text)[0]["translation_text"] | |
| return hi_sen | |
| input_box = gr.Textbox(label="English sentence", placeholder="Your english sentence here.", lines=2) | |
| dem = gr.Interface(fn=generate, | |
| inputs=input_box, | |
| outputs="text", | |
| title=title, | |
| description=description, | |
| examples=[["What a beautiful day"], ["What are you doing?"]]) | |
| dem.launch(share=True, debug=True) | |