Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,13 @@ import json
|
|
8 |
from anthropic import Anthropic, Client
|
9 |
import gradio as gr
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
## Process pdf
|
12 |
|
13 |
def convert_pdf_to_image(pdf_path):
|
@@ -56,7 +63,7 @@ def destamp_image(img_path):
|
|
56 |
# Resize using numpy.resize()
|
57 |
result_img = np.resize(threshold_img_2, new_shape)
|
58 |
print(f"result_img.shape: {result_img.shape}")
|
59 |
-
|
60 |
|
61 |
#save result_img
|
62 |
result_filepath="result_img_0.png"
|
|
|
8 |
from anthropic import Anthropic, Client
|
9 |
import gradio as gr
|
10 |
|
11 |
+
def get_base64_encorded_image(image_path):
|
12 |
+
with open(image_path, "rb") as image_file:
|
13 |
+
binary_data = image_file.read()
|
14 |
+
base64_encorded_data = base64.b64encode(binary_data)
|
15 |
+
base64_string = base64_encorded_data.decode('utf-8')
|
16 |
+
return base64_string
|
17 |
+
|
18 |
## Process pdf
|
19 |
|
20 |
def convert_pdf_to_image(pdf_path):
|
|
|
63 |
# Resize using numpy.resize()
|
64 |
result_img = np.resize(threshold_img_2, new_shape)
|
65 |
print(f"result_img.shape: {result_img.shape}")
|
66 |
+
cv2.imshow(result_img)
|
67 |
|
68 |
#save result_img
|
69 |
result_filepath="result_img_0.png"
|