Bajiyo commited on
Commit
af8878c
·
verified ·
1 Parent(s): 29c37b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -8
app.py CHANGED
@@ -1,17 +1,28 @@
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
 
 
1
  import gradio as gr
2
  from huggingface_hub import from_pretrained_keras
3
 
4
+ # Load the model from Hugging Face Hub
5
  model = from_pretrained_keras("Bajiyo/Malayalam_transliteration")
6
 
7
+ # Function to preprocess text (replace with model-specific preprocessing if needed)
8
+ def preprocess_text(input_text):
9
+ # Assuming character-level model: convert text to sequence of integer indices
10
+ # Replace with your specific preprocessing steps based on the model's requirements
11
+ # You might need tokenization or other transformations
12
+ # ...
13
+ return preprocessed_text
14
+
15
  def transliterate(input_text):
16
+ # Preprocess the input text
17
+ preprocessed_text = preprocess_text(input_text)
18
+
19
+ # Make predictions using the model
20
+ predictions = model.predict(preprocessed_text)
21
+
22
+ # Post-process the predictions if needed (replace with your logic)
23
+ output_text = predictions # Assuming model outputs transliteration directly
24
+
25
+ return output_text
26
 
27
  textbox = gr.inputs.Textbox(label="Enter Malayalam Text")
28