kavyamanohar
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -69,17 +69,51 @@ def transliterate_with_split_tokens(input_text, model, source_tokenizer, target_
|
|
69 |
def transliterate(input_text):
|
70 |
return transliterate_with_split_tokens(input_text, model, source_tokenizer, target_tokenizer, max_seq_length)
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
def transliterate(input_text):
|
70 |
return transliterate_with_split_tokens(input_text, model, source_tokenizer, target_tokenizer, max_seq_length)
|
71 |
|
72 |
+
|
73 |
+
# Create Gradio interface with enhanced features
|
74 |
+
def create_transliteration_interface():
|
75 |
+
# Define input and output components with more details
|
76 |
+
input_textbox = gr.Textbox(
|
77 |
+
lines=3,
|
78 |
+
placeholder="Enter English text to transliterate to Malayalam...",
|
79 |
+
label="Input Text"
|
80 |
+
)
|
81 |
+
|
82 |
+
output_textbox = gr.Textbox(
|
83 |
+
lines=3,
|
84 |
+
label="Transliterated Malayalam Text"
|
85 |
+
)
|
86 |
+
|
87 |
+
# Create the Gradio interface with more comprehensive configuration
|
88 |
+
interface = gr.Interface(
|
89 |
+
fn=transliterate,
|
90 |
+
inputs=[
|
91 |
+
gr.Textbox(
|
92 |
+
lines=3,
|
93 |
+
placeholder="Enter English text to transliterate to Malayalam...",
|
94 |
+
label="Input Text"
|
95 |
+
)
|
96 |
+
],
|
97 |
+
outputs=[
|
98 |
+
gr.Textbox(
|
99 |
+
lines=3,
|
100 |
+
label="Transliterated Malayalam Text"
|
101 |
+
)
|
102 |
+
],
|
103 |
+
title="🌟 English to Malayalam Transliterator",
|
104 |
+
description="Transliterate English text to Malayalam characters. Simply type or paste your English text, and see the Malayalam transliteration instantly!",
|
105 |
+
article="## How to Use\n1. Enter English text in the input box\n2. The transliteration will appear automatically\n3. Works with words, phrases, and sentences",
|
106 |
+
examples=[
|
107 |
+
["ente veed"],
|
108 |
+
["malayalam padikkano ? 😃"],
|
109 |
+
["india ente rajyamanu"]
|
110 |
+
],
|
111 |
+
theme="huggingface"
|
112 |
+
)
|
113 |
+
|
114 |
+
return interface
|
115 |
+
|
116 |
+
# Launch the Gradio interface
|
117 |
+
if __name__ == "__main__":
|
118 |
+
iface = create_transliteration_interface()
|
119 |
+
iface.launch()
|