vjdevane commited on
Commit
dd49bda
·
verified ·
1 Parent(s): 49259bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -1,16 +1,20 @@
1
  import gradio as gr
2
- from tensorflow.keras.models import load_model
3
  import keras.backend as K
4
  import cv2
5
  import numpy as np
6
 
7
- # Define the custom loss function
8
- def ctc_lambda_func(args):
9
- y_pred, labels, input_length, label_length = args
10
- return K.ctc_batch_cost(labels, y_pred, input_length, label_length)
 
 
 
 
 
 
11
 
12
- # Load the model, providing the custom loss function in the custom_objects dictionary
13
- loaded_model = load_model('Text_recognizer_Using_CRNN_model.keras', custom_objects={'ctc': ctc_lambda_func},safe_mode=False)
14
 
15
  def process_image(img):
16
  """
 
1
  import gradio as gr
2
+ from keras.models import load_model
3
  import keras.backend as K
4
  import cv2
5
  import numpy as np
6
 
7
+ # # Define the custom loss function
8
+ # def ctc_lambda_func(args):
9
+ # y_pred, labels, input_length, label_length = args
10
+ # return K.ctc_batch_cost(labels, y_pred, input_length, label_length)
11
+
12
+ # # Load the model, providing the custom loss function in the custom_objects dictionary
13
+ # loaded_model = load_model('Text_recognizer_Using_CRNN_model.keras', custom_objects={'ctc': ctc_lambda_func},safe_mode=False)
14
+ char_list = "!\"#&'()*+,-./0123456789:;?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
15
+
16
+ model = load_model('Text_recognizer_Using_CRNN.h5')
17
 
 
 
18
 
19
  def process_image(img):
20
  """