kavyamanohar commited on
Commit
38ddf7b
·
verified ·
1 Parent(s): 54b4405

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -14
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
- input_text = "ente veed "
73
- transliterated_text = transliterate_with_split_tokens(input_text, model, source_tokenizer, target_tokenizer, max_seq_length)
74
-
75
- transliterated_text
76
- # Create a Gradio interface
77
- iface = gr.Interface(
78
- fn=transliterate,
79
- inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
80
- outputs="text",
81
- title="English to Malayalam Transliteration",
82
- description="Transliterate English text to Malayalam.",
83
- )
84
-
85
- iface.launch(share=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()