File size: 1,578 Bytes
3b3f0b7
f2874d4
 
 
3b3f0b7
f2874d4
3b3f0b7
f2874d4
3b3f0b7
f2874d4
 
 
3b3f0b7
13639ab
3b3f0b7
f2874d4
3b3f0b7
f2874d4
3b3f0b7
 
 
f2874d4
a655b3e
193e21a
b921c58
f2874d4
 
1acdcd2
9fa262a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# This is a Gradio app that transliterates English text to Hindi.
import gradio as gr
from xlit_src import XlitEngine

# Define the transliteration function.
def transliterate(input_text):
    # Initialize the transliteration engine.
    engine = XlitEngine()
    # Transliterate the input text.
    result = engine.translit_sentence(input_text)
    return result

# Create the input and output components.
input_box = gr.Textbox(type="text", label="Input Text")
output_box = gr.Textbox(label="Transliterated Text")

# Create the Gradio interface.
iface = gr.Interface(
    fn=transliterate,
    inputs=input_box,
    outputs=output_box,
    title="English to Hindi Transliteration",
    description='Model for Transliterating English to Hindi using a Character-level recurrent sequence-to-sequence trained using <a href="http://workshop.colips.org/news2018/dataset.html">NEWS2018 DATASET_04</a>',
    article='Author: <a href="https://huggingface.co/anuragshas">Anurag Singh</a> . Using training and inference script from <a href="https://github.com/AI4Bharat/IndianNLP-Transliteration.git">AI4Bharat/IndianNLP-Transliteration</a><p><center><a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fanuragshas%2Fen-hi-transliteration"><img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fanuragshas%2Fen-hi-transliteration&labelColor=%23d9e3f0&countColor=%232ccce4" /></a></center></p>',
    examples=["Namaste"],
)

# Launch the interface with caching enabled.
iface.launch(show_api=False, mcp_server=True)