Puyush commited on
Commit
5452068
·
verified ·
1 Parent(s): 5ce7819

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -7,7 +7,6 @@ import gradio as gr
7
  import tensorflow as tf
8
  from keras import layers
9
  from pathlib import Path
10
- from pathlib import Path
11
  from collections import Counter
12
 
13
  def ctc_batch_cost(y_true, y_pred, input_length, label_length):
@@ -132,6 +131,9 @@ def distortion_free_resize(image, img_size):
132
 
133
  def decode_batch_predictions(input_image):
134
  img_size=(128, 32)
 
 
 
135
  input_image = tf.io.decode_image(input_image, channels=1, dtype=tf.dtypes.uint8)
136
  input_image = distortion_free_resize(input_image, img_size)
137
  input_image = tf.image.convert_image_dtype(input_image, tf.float32)/255.0
 
7
  import tensorflow as tf
8
  from keras import layers
9
  from pathlib import Path
 
10
  from collections import Counter
11
 
12
  def ctc_batch_cost(y_true, y_pred, input_length, label_length):
 
131
 
132
  def decode_batch_predictions(input_image):
133
  img_size=(128, 32)
134
+ img_byte_array = io.BytesIO()
135
+ input_image.save(img_byte_array, format='JPG') # Change the format as needed
136
+ input_image = img_byte_array.getvalue()
137
  input_image = tf.io.decode_image(input_image, channels=1, dtype=tf.dtypes.uint8)
138
  input_image = distortion_free_resize(input_image, img_size)
139
  input_image = tf.image.convert_image_dtype(input_image, tf.float32)/255.0