mohammad2928git commited on
Commit
821fca7
·
verified ·
1 Parent(s): 4e97d5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -85,14 +85,14 @@ Generate OCR
85
  def process(input_type, gr_img, lang):
86
 
87
  if isinstance(gr_img, np.ndarray):
88
- # Create a temporary file to save the image
89
- with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file:
90
- temp_path = temp_file.name
91
- # Save the NumPy array as an image file
92
- Image.fromarray(gr_img).save(temp_path)
93
 
94
  image = Image.open(temp_path)
95
- image = file
96
  extracted_text = ocr(image, lang)
97
  return extracted_text
98
 
 
85
  def process(input_type, gr_img, lang):
86
 
87
  if isinstance(gr_img, np.ndarray):
88
+ # Create a temporary file to save the image
89
+ with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file:
90
+ temp_path = temp_file.name
91
+ # Save the NumPy array as an image file
92
+ Image.fromarray(gr_img).save(temp_path)
93
 
94
  image = Image.open(temp_path)
95
+ # image = file
96
  extracted_text = ocr(image, lang)
97
  return extracted_text
98