Skip to content

Commit 51a14a8

Browse files
authored
Merge pull request #306 from shijinpjlab/dev_1222
feat: fix bug gradio detail repeat
2 parents 4497838 + 4c09803 commit 51a14a8

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

app_gradio/app.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def dingo_demo(
156156
"executor": {
157157
"result_save": {
158158
"bad": True,
159-
"good": True
159+
# "raw": True
160160
},
161161
"max_workers": max_workers,
162162
"batch_size": batch_size,
@@ -176,9 +176,12 @@ def dingo_demo(
176176
executor = Executor.exec_map["local"](input_args)
177177
summary = executor.execute().to_dict()
178178
detail = executor.get_bad_info_list()
179+
dingo_id_set = set()
179180
new_detail = []
180181
for item in detail:
181-
new_detail.append(item)
182+
if item['dingo_id'] not in dingo_id_set:
183+
dingo_id_set.add(item['dingo_id'])
184+
new_detail.append(item)
182185
if summary['output_path']:
183186
if remove_output == "true":
184187
shutil.rmtree(summary['output_path'])

dingo/model/rule/rule_common.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ def eval(cls, input_data: Data) -> EvalDetail:
3333
res.status = True
3434
# res.merge(tmp_res)
3535
res.label = [f"{cls.metric_type}.{cls.__name__}"]
36-
res.reason = [] if res.reason is None else res.reason.extend(tmp_res.reason)
36+
if res.reason is None:
37+
res.reason = []
38+
res.reason.extend(tmp_res.reason)
3739
# Set QUALITY_GOOD when all checks pass
3840
if not res.status:
3941
res.label = [QualityLabel.QUALITY_GOOD]
@@ -63,7 +65,9 @@ def eval(cls, input_data: Data) -> EvalDetail:
6365
res.status = True
6466
# res.merge(tmp_res)
6567
res.label = [f"{cls.metric_type}.{cls.__name__}"]
66-
res.reason = [] if res.reason is None else res.reason.extend(tmp_res.reason)
68+
if res.reason is None:
69+
res.reason = []
70+
res.reason.extend(tmp_res.reason)
6771
# Set QUALITY_GOOD when all checks pass
6872
if not res.status:
6973
res.label = [QualityLabel.QUALITY_GOOD]
@@ -647,7 +651,9 @@ def eval(cls, input_data: Data) -> EvalDetail:
647651
res.status = True
648652
# res.merge(tmp_res)
649653
res.label = [f"{cls.metric_type}.{cls.__name__}"]
650-
res.reason = [] if res.reason is None else res.reason.extend(tmp_res.reason)
654+
if res.reason is None:
655+
res.reason = []
656+
res.reason.extend(tmp_res.reason)
651657
# Set QUALITY_GOOD when all checks pass
652658
if not res.status:
653659
res.label = [QualityLabel.QUALITY_GOOD]

0 commit comments

Comments
 (0)