Skip to content

Commit

Permalink
Fix predict.py stuck at help page (#183)
Browse files Browse the repository at this point in the history
* Fix stuck at help page

* Add return statement to predict_score function
  • Loading branch information
liuyanyi authored Jan 18, 2024
1 parent 22bdb68 commit 8600d83
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/quality_classifier/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def predict_score(dataset_path,
:param overall_stats: whether to output an overall stats report on
predicted document scores. It's False in default
:return:
average quality score of the document
None if overall_stats is False
average quality score of the document if overall_stats is True
"""
# set default tokenizers for default models
if model == 'chinese':
Expand Down Expand Up @@ -121,14 +122,13 @@ def predict_score(dataset_path,
# export prediction result to specific path
export_result(pred, result_path)

# generate overall statistics on doc scores
overall = pred.select('doc_score').toPandas().describe(include='all')
if overall_stats:
# generate overall statistics on doc scores
overall = pred.select('doc_score').toPandas().describe(include='all')
# export to result report file
overall.to_csv(os.path.join(result_path, 'overall.csv'))
overall.to_markdown(os.path.join(result_path, 'overall.md'))

return overall
return overall


if __name__ == '__main__':
Expand Down

0 comments on commit 8600d83

Please sign in to comment.