keyword 'show' to fix annotation script without causing problems for non-script usage
This commit is contained in:
parent
64258ed6e1
commit
0b96980cc5
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,3 +21,4 @@ build_venv/
|
||||
/cv_analysis.egg-info/PKG-INFO
|
||||
/cv_analysis.egg-info/SOURCES.txt
|
||||
/cv_analysis.egg-info/top_level.txt
|
||||
/.vscode/
|
||||
|
||||
@ -28,7 +28,7 @@ def detect_figures(image: np.array):
|
||||
return list(rects)
|
||||
|
||||
|
||||
def detect_figures_in_pdf(pdf_path, page_index=1, show=True):
|
||||
def detect_figures_in_pdf(pdf_path, page_index=1, show=False):
|
||||
|
||||
page = pdf2image.convert_from_path(pdf_path, first_page=page_index + 1, last_page=page_index + 1)[0]
|
||||
page = np.array(page)
|
||||
|
||||
@ -36,7 +36,7 @@ def find_redactions(image: np.array, min_normalized_area=200000):
|
||||
return []
|
||||
|
||||
|
||||
def annotate_redactions_in_pdf(pdf_path, page_index=1, show=True):
|
||||
def annotate_redactions_in_pdf(pdf_path, page_index=1, show=False):
|
||||
|
||||
page = pdf2image.convert_from_path(pdf_path, first_page=page_index + 1, last_page=page_index + 1)[0]
|
||||
page = np.array(page)
|
||||
|
||||
@ -141,7 +141,7 @@ def parse_table(image: np.array, show=False):
|
||||
return list(rects)
|
||||
|
||||
|
||||
def annotate_tables_in_pdf(pdf_path, page_index=0, deskew=False, show=True):
|
||||
def annotate_tables_in_pdf(pdf_path, page_index=0, deskew=False, show=False):
|
||||
page = pdf2image.convert_from_path(pdf_path, first_page=page_index + 1, last_page=page_index + 1)[0]
|
||||
page = np.array(page)
|
||||
if deskew:
|
||||
|
||||
@ -20,10 +20,10 @@ def parse_args():
|
||||
if __name__ == "__main__":
|
||||
args = parse_args()
|
||||
if args.type == "table":
|
||||
annotate_tables_in_pdf(args.pdf_path, page_index=args.page_index)
|
||||
annotate_tables_in_pdf(args.pdf_path, page_index=args.page_index, show=True)
|
||||
elif args.type == "redaction":
|
||||
annotate_redactions_in_pdf(args.pdf_path, page_index=args.page_index)
|
||||
annotate_redactions_in_pdf(args.pdf_path, page_index=args.page_index, show=True)
|
||||
elif args.type == "layout":
|
||||
annotate_layout_in_pdf(args.pdf_path, page_index=args.page_index)
|
||||
annotate_layout_in_pdf(args.pdf_path, page_index=args.page_index, show=True)
|
||||
elif args.type == "figure":
|
||||
detect_figures_in_pdf(args.pdf_path, page_index=args.page_index)
|
||||
detect_figures_in_pdf(args.pdf_path, page_index=args.page_index, show=True)
|
||||
|
||||
@ -2,7 +2,6 @@ import json
|
||||
import tracemalloc
|
||||
from sys import getsizeof
|
||||
import logging
|
||||
from typing import List
|
||||
from flask import Flask, request, jsonify
|
||||
from prometheus_client import Counter, Gauge
|
||||
from prometheus_flask_exporter import PrometheusMetrics
|
||||
@ -21,15 +20,10 @@ from cv_analysis.config import CONFIG
|
||||
|
||||
def suppress_user_warnings():
|
||||
import warnings
|
||||
|
||||
warnings.filterwarnings("ignore")
|
||||
|
||||
|
||||
def main():
|
||||
run_server()
|
||||
|
||||
|
||||
def run_server():
|
||||
file_counter = Counter("cv_analysis_file_counter", "count processed files")
|
||||
# page_counter = Counter("cv_analysis_page_counter", "count pages from processed files")
|
||||
ram_metric = Gauge("cv_analysis_memory_usage", "Memory usage in Mb")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user