Fix: minor bugs
This commit is contained in:
parent
ce73ab9b7e
commit
45d3f61898
47
.env_dev
Normal file
47
.env_dev
Normal file
@ -0,0 +1,47 @@
|
||||
MEDIA_ROOT=/app/media
|
||||
# DATABASE django setup
|
||||
DB_ENGINE=django.db.backends.postgresql_psycopg2
|
||||
DB_SCHEMA=sbt_prod_20240422_1
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=TannedCung
|
||||
DB_HOST=db-sbt
|
||||
DB_PUBLIC_PORT=5432
|
||||
DB_INTERNAL_PORT=5432
|
||||
|
||||
DEBUG=TRUE
|
||||
CORS_ALLOWED_ORIGINS=*
|
||||
CTEL_KEY=fTjWnZr4u7x!A%D*G-KaPdRgUkXp2s5v
|
||||
DB_INTERNAL_KEY=7LYk-iaWTFPqsZHIE5GHuv41S0c_Vlb0ZVc-BnsEZqQ=
|
||||
ALLOWED_HOSTS='*'
|
||||
BROKER_URL=amqp://test:test@rabbitmq-manulife-sbt:5672
|
||||
BASE_URL=http://be-ctel-sbt:9000
|
||||
BASE_UI_URL=http://fe-sbt:9801
|
||||
HOST_MEDIA_FOLDER=./media
|
||||
GID=1000
|
||||
UID=198
|
||||
SECRET_KEY=999999999999999999999999999999999999999999999999999999999999999999
|
||||
RABBITMQ_DEFAULT_USER=test
|
||||
RABBITMQ_DEFAULT_PASS=test
|
||||
BASE_PORT=9000
|
||||
# S3_HOST=http://minio:9884
|
||||
# S3_ACCESS_KEY=TannedCung
|
||||
# S3_SECRET_KEY=TannedCung
|
||||
# S3_BUCKET_NAME=ocr-sds
|
||||
S3_ACCESS_KEY=AKIA3AFPFVWZHYID6NY7
|
||||
S3_SECRET_KEY=qKZHYIrHZS1806G8zAGJm/9Nq4pIaPuGPRXCJU5m
|
||||
S3_BUCKET_NAME=ocr-sds
|
||||
|
||||
AUTH_TOKEN_LIFE_TIME=168
|
||||
IMAGE_TOKEN_LIFE_TIME=168
|
||||
INTERNAL_SDS_KEY=TannedCung
|
||||
ADMIN_USER_NAME=sbt
|
||||
ADMIN_PASSWORD=abc
|
||||
STANDARD_USER_NAME=sbt_standard
|
||||
STANDARD_PASSWORD=abc
|
||||
|
||||
# Front end env variables
|
||||
# VITE_PORT=80
|
||||
# VITE_PROXY=http://0.0.0.0
|
||||
# VITE_API_BASE_URL=http://0.0.0.0:8000
|
||||
# PORT=8002
|
||||
# PORT=8002
|
@ -986,7 +986,7 @@ class AccuracyViewSet(viewsets.ViewSet):
|
||||
if k in sample_result.keys():
|
||||
if not isinstance(sample_result[k], list):
|
||||
sample_result[k] = v
|
||||
else:
|
||||
elif v:
|
||||
sample_result[k].append(v)
|
||||
|
||||
if subscription_request_file.reviewed_result is not None:
|
||||
@ -994,7 +994,9 @@ class AccuracyViewSet(viewsets.ViewSet):
|
||||
else:
|
||||
subscription_request_file.reviewed_result = sample_result
|
||||
|
||||
if reason:
|
||||
subscription_request_file.reason = reason
|
||||
if solution:
|
||||
subscription_request_file.counter_measures = solution
|
||||
subscription_request_file.is_reviewed = True
|
||||
subscription_request_file.save()
|
||||
|
@ -126,16 +126,12 @@ def create_accuracy_report(report_id, **kwargs):
|
||||
rq_accuracy = {"feedback": [],
|
||||
"reviewed": []}
|
||||
|
||||
for _att in _atts:
|
||||
for t in _att["acc"].keys():
|
||||
for cl in _att["acc"][t].keys():
|
||||
rq_accuracy[t] += _att["acc"][t][cl]
|
||||
for rpf in _report_files:
|
||||
for cl in rpf.feedback_accuracy.keys():
|
||||
rq_accuracy["feedback"] += rpf.feedback_accuracy[cl]
|
||||
for cl in rpf.reviewed_accuracy.keys():
|
||||
rq_accuracy["reviewed"] += rpf.reviewed_accuracy[cl]
|
||||
|
||||
# for rpf in _report_files:
|
||||
# for cl in rpf.feedback_accuracy.keys():
|
||||
# rq_accuracy["feedback"] += rpf.feedback_accuracy[cl]
|
||||
# for cl in rpf.reviewed_accuracy.keys():
|
||||
# rq_accuracy["reviewed"] += rpf.reviewed_accuracy[cl]
|
||||
request.is_required = False
|
||||
if len(rq_accuracy["reviewed"]) > 0:
|
||||
request.raw_accuracy = mean_list(rq_accuracy["reviewed"])
|
||||
|
@ -351,6 +351,7 @@ class ReportAccumulateByRequest:
|
||||
for key in settings.FIELD:
|
||||
_report["average_accuracy_rate"][key] = _report["average_accuracy_rate"][key]()
|
||||
for accuracy_type in ["feedback_accuracy", "reviewed_accuracy"]:
|
||||
if (_report[accuracy_type][key].count + count_acc) > 0:
|
||||
avg_acc = (avg_acc*count_acc + _report[accuracy_type][key].avg*_report[accuracy_type][key].count) / (_report[accuracy_type][key].count + count_acc)
|
||||
count_acc += _report[accuracy_type][key].count
|
||||
|
||||
|
@ -14,12 +14,16 @@ class MinioS3Client:
|
||||
aws_access_key_id=access_key,
|
||||
aws_secret_access_key=secret_key
|
||||
)
|
||||
else:
|
||||
elif len(secret_key) > 0 and len(access_key) > 0:
|
||||
self.s3_client = boto3.client(
|
||||
's3',
|
||||
aws_access_key_id=access_key,
|
||||
aws_secret_access_key=secret_key
|
||||
)
|
||||
else:
|
||||
self.s3_client = boto3.client(
|
||||
's3')
|
||||
|
||||
except Exception as e:
|
||||
print(f"[WARM] Unable to create an s3 client, {e}")
|
||||
self.s3_client = None
|
||||
|
Loading…
Reference in New Issue
Block a user