testmail-gmail commited on
Commit
4a4cc2c
·
1 Parent(s): 81c81bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -4,6 +4,7 @@ import time
4
  import torch
5
  import argparse
6
  import gradio as gr
 
7
  from PIL import Image
8
  from numpy import random
9
  from pathlib import Path
@@ -153,7 +154,7 @@ def detect_Custom(img,model,boundedImage):
153
  images = [keras_ocr.tools.read(img) for img in [boundedImage]]
154
  prediction_groups = pipeline.recognize(images)
155
  plt.figure(figsize = (10,20))
156
- plt.imshow(images[0])
157
  fig, ax = plt.subplots(figsize=(10, 20))
158
  keras_ocr.tools.drawAnnotations(image=images[0], predictions=prediction_groups[0], ax=ax)
159
  if save_txt or save_img:
@@ -161,7 +162,7 @@ def detect_Custom(img,model,boundedImage):
161
 
162
  print(f'Done. ({time.time() - t0:.3f}s)')
163
 
164
- return Image.fromarray(im0[:,:,::-1]), asarray(images[0])
165
 
166
 
167
 
 
4
  import torch
5
  import argparse
6
  import gradio as gr
7
+ import io
8
  from PIL import Image
9
  from numpy import random
10
  from pathlib import Path
 
154
  images = [keras_ocr.tools.read(img) for img in [boundedImage]]
155
  prediction_groups = pipeline.recognize(images)
156
  plt.figure(figsize = (10,20))
157
+
158
  fig, ax = plt.subplots(figsize=(10, 20))
159
  keras_ocr.tools.drawAnnotations(image=images[0], predictions=prediction_groups[0], ax=ax)
160
  if save_txt or save_img:
 
162
 
163
  print(f'Done. ({time.time() - t0:.3f}s)')
164
 
165
+ return Image.fromarray(im0[:,:,::-1]), keras_ocr.tools.drawAnnotations(image=images[0], predictions=prediction_groups[0], ax=ax))
166
 
167
 
168