Update app.py
Browse files
app.py
CHANGED
|
@@ -48,7 +48,15 @@ def grade_pdf(input_pdf, pdffigures2_jar):
|
|
| 48 |
# Read and return the JSON data
|
| 49 |
if os.path.exists(output_json_file):
|
| 50 |
with open(output_json_file, "r") as f:
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
else:
|
| 53 |
raise Exception(f"JSON output file not found: {output_json_file}")
|
| 54 |
|
|
|
|
| 48 |
# Read and return the JSON data
|
| 49 |
if os.path.exists(output_json_file):
|
| 50 |
with open(output_json_file, "r") as f:
|
| 51 |
+
regions = json.load(f)
|
| 52 |
+
|
| 53 |
+
for region in regions:
|
| 54 |
+
if(region["captionBoundary"]["y1"]>region["regionBoundary"]["y1"]):
|
| 55 |
+
region["captionLocation"]="Below"
|
| 56 |
+
else:
|
| 57 |
+
region["captionLocation"]="Above"
|
| 58 |
+
return regions
|
| 59 |
+
|
| 60 |
else:
|
| 61 |
raise Exception(f"JSON output file not found: {output_json_file}")
|
| 62 |
|