coolfrxcrazy
commited on
Commit
•
5b3d288
1
Parent(s):
27ce2a0
Update app.py
Browse files
app.py
CHANGED
@@ -213,8 +213,10 @@ def ocr(image):
|
|
213 |
# Perform OCR on the image using the file path
|
214 |
res = model.chat(tokenizer=tokenizer, image=temp_image_path, ocr_type='ocr') # Pass the file path here
|
215 |
|
|
|
|
|
216 |
# Return the extracted text
|
217 |
-
return res['text'] # Adjust this based on the actual return structure
|
218 |
except Exception as e:
|
219 |
return str(e)
|
220 |
|
|
|
213 |
# Perform OCR on the image using the file path
|
214 |
res = model.chat(tokenizer=tokenizer, image=temp_image_path, ocr_type='ocr') # Pass the file path here
|
215 |
|
216 |
+
output_text = tokenizer.decode(res[0], skip_special_tokens=True)
|
217 |
+
return output_text
|
218 |
# Return the extracted text
|
219 |
+
# return res['text'] # Adjust this based on the actual return structure
|
220 |
except Exception as e:
|
221 |
return str(e)
|
222 |
|