Bajiyo commited on
Commit
d18faba
1 Parent(s): 0688df4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -5,9 +5,6 @@ from keras.preprocessing.text import Tokenizer
5
 
6
  # Load your custom Keras model
7
  model = load_model('/content/drive/MyDrive/best_model.h5')
8
-
9
- # Assuming 'source_tokenizer' is the tokenizer used during training
10
- # You may need to adapt this based on your actual tokenizer
11
  tokenizer = source_tokenizer
12
 
13
  # Function for transliteration
@@ -18,8 +15,8 @@ def transliterate_malayalam_to_english(malayalam_text):
18
  # Use the model for prediction
19
  output_sequence = model.predict(input_sequence)
20
 
21
- # Decode the output sequence to get the transliterated text (adjust this based on your decoding logic)
22
- predicted_text = decode_output_sequence(output_sequence)
23
 
24
  return predicted_text
25
 
 
5
 
6
  # Load your custom Keras model
7
  model = load_model('/content/drive/MyDrive/best_model.h5')
 
 
 
8
  tokenizer = source_tokenizer
9
 
10
  # Function for transliteration
 
15
  # Use the model for prediction
16
  output_sequence = model.predict(input_sequence)
17
 
18
+ # Use argmax to get the most likely characters
19
+ predicted_text = "".join([tokenizer.index_word[idx] for idx in np.argmax(output_sequence, axis=-1)[0] if idx != 0])
20
 
21
  return predicted_text
22