Spaces:
Runtime error
Runtime error
Added app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
pipe = pipeline("translation", model="fubuki119/opus-mt-en-hi")
|
| 5 |
+
|
| 6 |
+
title = "English to Hindi Translator"
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
description = """
|
| 10 |
+
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
|
| 11 |
+
<a href="https://huggingface.co/datasets/cfilt/iitb-english-hindi"> iitb-english-hindi </a> dataset.
|
| 12 |
+
<img src="https://github.com/VaruN-dev-dev/Machine-Translation/blob/master/images/app_image.png" width=200px>
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
def generate(text):
|
| 16 |
+
hi_sen = pipe(text)[0]["translation_text"]
|
| 17 |
+
return hi_sen
|
| 18 |
+
|
| 19 |
+
input_box = gr.Textbox(label="English sentence", placeholder="Your english sentence here.", lines=2)
|
| 20 |
+
dem = gr.Interface(fn=generate,
|
| 21 |
+
inputs=input_box,
|
| 22 |
+
outputs="text",
|
| 23 |
+
title=title,
|
| 24 |
+
description=description,
|
| 25 |
+
examples=[["What a beautiful day"], ["What are you doing?"]])
|
| 26 |
+
dem.launch(share=True, debug=True)
|