vjdevane commited on
Commit
882416c
·
verified ·
1 Parent(s): 8775ef0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,11 +1,14 @@
1
  import gradio as gr
2
  from keras.models import load_model
3
  import keras.backend as K
 
 
4
  def ctc_lambda_func(args):
5
  y_pred, labels, input_length, label_length = args
6
  return K.ctc_batch_cost(labels, y_pred, input_length, label_length)
7
-
8
- model = load_model('Text_recognizer_Using_CRNN_model.h5',custom_objects={'ctc': ctc_lambda_func})
 
9
 
10
  def greet(name):
11
  return "Hello " + name + "!!"
 
1
  import gradio as gr
2
  from keras.models import load_model
3
  import keras.backend as K
4
+
5
+ # Define the custom loss function
6
  def ctc_lambda_func(args):
7
  y_pred, labels, input_length, label_length = args
8
  return K.ctc_batch_cost(labels, y_pred, input_length, label_length)
9
+
10
+ # Load the model, providing the custom loss function in the custom_objects dictionary
11
+ loaded_model = load_model('Text_recognizer_Using_CRNN_model.h5', custom_objects={'ctc': ctc_lambda_func})
12
 
13
  def greet(name):
14
  return "Hello " + name + "!!"