diff --git a/cope2n-ai-fi/api/sdsap_sbt/prediction_sbt.py b/cope2n-ai-fi/api/sdsap_sbt/prediction_sbt.py index 3a4bed3..a59a653 100755 --- a/cope2n-ai-fi/api/sdsap_sbt/prediction_sbt.py +++ b/cope2n-ai-fi/api/sdsap_sbt/prediction_sbt.py @@ -4,6 +4,7 @@ import urllib import random import numpy as np from pathlib import Path +import urllib.parse import uuid from copy import deepcopy import sys, os @@ -33,10 +34,18 @@ def sbt_predict(image_url, engine, metadata={}) -> None: img = cv2.imdecode(arr, -1) save_dir = "./tmp_results" + try: + + parsed_url = urllib.parse.urlparse(image_url) + query_params = urllib.parse.parse_qs(parsed_url.query) + file_name = query_params['file_name'][0] + except Exception as e: + print(f"[ERROR]: Error extracting file name from url: {image_url}") + file_name = f"{uuid.uuid4()}.jpg" os.makedirs(save_dir, exist_ok=True) # image_path = os.path.join(save_dir, f"{image_url}.jpg") os.makedirs(save_dir, exist_ok = True) - tmp_image_path = os.path.join(save_dir, f"{uuid.uuid4()}.jpg") + tmp_image_path = os.path.join(save_dir, file_name) cv2.imwrite(tmp_image_path, img) extra_params = {'sub': metadata.get("subsidiary", None)} # example of 'AU' outputs = process_img(img=tmp_image_path, diff --git a/cope2n-api/fwd_api/utils/accuracy.py b/cope2n-api/fwd_api/utils/accuracy.py index ceced56..66bea04 100755 --- a/cope2n-api/fwd_api/utils/accuracy.py +++ b/cope2n-api/fwd_api/utils/accuracy.py @@ -847,7 +847,6 @@ def calculate_a_request(report, request): rv_avg_acc = avg_dict(att["acc"]["reviewed"]) image.is_required = fb_avg_acc < settings.BAD_THRESHOLD - image.is_reviewed = rv_avg_acc > 0 if image.processing_time < 0: continue diff --git a/cope2n-fe/src/pages/reviews2/FileCard.tsx b/cope2n-fe/src/pages/reviews2/FileCard.tsx index 7156e9d..79efa76 100644 --- a/cope2n-fe/src/pages/reviews2/FileCard.tsx +++ b/cope2n-fe/src/pages/reviews2/FileCard.tsx @@ -8,10 +8,9 @@ import { Button, Tag } from 'antd'; const FileCard = ({ file, isSelected, onClick }) => { const fileName = file['File Name']; const extensionType = fileName.split('.').pop(); - let status = true; - if (file['Is Required'] && !file['Is Reviewed']) { - status = false; - } + const isRequired = file['Is Required']; + const isReviewd = file['Is Reviewed']; + return (
{ > {fileName ? fileName.substring(0, 25).replace('temp_', '') - : fileName} - {' '}({extensionType}) + : fileName}{' '} + ({extensionType})
- : - } - style={{ display: 'inline-block', fontWeight: 'bold' }} - // bordered={false} - > - {status ? 'Good' : 'Warning'}{' '} - +
+ + Required: {isRequired.toString()} + + + + + Reviewed: {isReviewd.toString()} + + +
@@ -721,7 +741,7 @@ const ReviewPage = () => { } } catch (error) {} return ( -
+
{ ghost icon={} size='small' - onClick={() => updateRevised(data)} + onClick={() => updateRevisedByFeedback(data)} />
{ placeholder='Select a reason' style={{ width: 170, flexBasis: '50%', height: '32px' }} options={REASON_BAD_QUALITY} - onChange={setReason} + onChange={(value) => { + let newReason = value; + setReason(newReason); + setSolution(counter_measure_map[newReason]); + }} value={reason} /> {reason === 'other' && (