Bajiyo commited on
Commit
80e0e9b
·
verified ·
1 Parent(s): 7f7346c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -15
app.py CHANGED
@@ -1,23 +1,24 @@
1
- from huggingface_hub import from_pretrained_keras
2
  import gradio as gr
 
3
 
4
- # Load the model from Hugging Face Hub (replace with correct model name)
5
  model = from_pretrained_keras("Bajiyo/Malayalam_transliteration")
6
 
7
  def transliterate(input_text):
8
- # Preprocess input text if needed (e.g., handle punctuation, special characters)
9
- preprocessed_text = preprocess_text(input_text)
10
-
11
- # Make predictions using the model
12
- predictions = model.predict(preprocessed_text)
13
-
14
- # Implement post-processing based on model's output format
15
  output_text = post_process_predictions(predictions)
16
-
17
  return output_text
18
 
19
- # Define Gradio interface
20
- inputs = gr.inputs.Textbox(label="Enter Malayalam Text")
21
- outputs = gr.outputs.Textbox(label="Transliteration to English")
22
- interface = gr.Interface(transliterate, inputs, outputs, title="Malayalam to English Transliteration")
23
- interface.launch()
 
 
 
 
 
 
1
  import gradio as gr
2
+ from huggingface_hub import from_pretrained_keras
3
 
4
+ # Load the model from Hugging Face
5
  model = from_pretrained_keras("Bajiyo/Malayalam_transliteration")
6
 
7
  def transliterate(input_text):
8
+ # Make predictions using the model directly
9
+ predictions = model.predict(input_text)
10
+
11
+ # Post-process the predictions if needed
 
 
 
12
  output_text = post_process_predictions(predictions)
13
+
14
  return output_text
15
 
16
+ textbox = gr.inputs.Textbox(label="Enter Malayalam Text")
17
+
18
+ demo = gr.Interface(fn=transliterate,
19
+ inputs=textbox,
20
+ outputs=gr.outputs.Textbox(label="Transliteration to English"),
21
+ title="Malayalam to English Transliteration"
22
+ )
23
+
24
+ demo.launch()