Update app.py
Browse files
app.py
CHANGED
|
@@ -15,8 +15,6 @@ def extract_text(image):
|
|
| 15 |
if isinstance(image, np.ndarray): # Chuyển NumPy array thành ảnh
|
| 16 |
image = Image.fromarray(image)
|
| 17 |
|
| 18 |
-
# Giới hạn kích thước ảnh
|
| 19 |
-
#image = image.resize((min(image.width, 1024), min(image.height, 1024)), Image.Resampling.LANCZOS)
|
| 20 |
|
| 21 |
# Chuyển đổi ảnh sang Base64
|
| 22 |
buffered = io.BytesIO()
|
|
@@ -46,7 +44,6 @@ def extract_text(image):
|
|
| 46 |
|
| 47 |
output_image_file = "output_image.png"
|
| 48 |
image.save(output_image_file, format="PNG")
|
| 49 |
-
|
| 50 |
return text, output_text_file, output_image_file
|
| 51 |
else:
|
| 52 |
error_msg = f"Lỗi: {str(response)}" if response else "Lỗi: Không kết nối được API."
|
|
|
|
| 15 |
if isinstance(image, np.ndarray): # Chuyển NumPy array thành ảnh
|
| 16 |
image = Image.fromarray(image)
|
| 17 |
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# Chuyển đổi ảnh sang Base64
|
| 20 |
buffered = io.BytesIO()
|
|
|
|
| 44 |
|
| 45 |
output_image_file = "output_image.png"
|
| 46 |
image.save(output_image_file, format="PNG")
|
|
|
|
| 47 |
return text, output_text_file, output_image_file
|
| 48 |
else:
|
| 49 |
error_msg = f"Lỗi: {str(response)}" if response else "Lỗi: Không kết nối được API."
|