addui
Browse files
ui.py
CHANGED
|
@@ -18,6 +18,7 @@ class OCRUI:
|
|
| 18 |
self.current_page = None
|
| 19 |
self.API_URL = "http://s15.serv00.com:9081/compareAnalyze"
|
| 20 |
self.stripe_remover = StripeRemover() # Initialize here
|
|
|
|
| 21 |
|
| 22 |
async def send_to_external_api(self, file_bytes):
|
| 23 |
async with aiohttp.ClientSession() as session:
|
|
@@ -123,9 +124,11 @@ class OCRUI:
|
|
| 123 |
with st.spinner('处理图像中...'):
|
| 124 |
processed_img = self.process_image(self.current_page, preprocess_method)
|
| 125 |
if processed_img is not None:
|
|
|
|
| 126 |
# Show preview
|
| 127 |
st.sidebar.image(processed_img, caption=f"预处理结果 - {preprocess_method}",
|
| 128 |
width=200)
|
|
|
|
| 129 |
|
| 130 |
# Encode and send
|
| 131 |
encode_params = [cv2.IMWRITE_JPEG_QUALITY, 50]
|
|
|
|
| 18 |
self.current_page = None
|
| 19 |
self.API_URL = "http://s15.serv00.com:9081/compareAnalyze"
|
| 20 |
self.stripe_remover = StripeRemover() # Initialize here
|
| 21 |
+
self.processed_image = None
|
| 22 |
|
| 23 |
async def send_to_external_api(self, file_bytes):
|
| 24 |
async with aiohttp.ClientSession() as session:
|
|
|
|
| 124 |
with st.spinner('处理图像中...'):
|
| 125 |
processed_img = self.process_image(self.current_page, preprocess_method)
|
| 126 |
if processed_img is not None:
|
| 127 |
+
self.processed_image = processed_img
|
| 128 |
# Show preview
|
| 129 |
st.sidebar.image(processed_img, caption=f"预处理结果 - {preprocess_method}",
|
| 130 |
width=200)
|
| 131 |
+
self.cols[0].image(processed_img)
|
| 132 |
|
| 133 |
# Encode and send
|
| 134 |
encode_params = [cv2.IMWRITE_JPEG_QUALITY, 50]
|