Skip to content

Commit

Permalink
Merge pull request #2408 from JosuaRieder/no_console_results
Browse files Browse the repository at this point in the history
Implement --no-console-results in inference.py
  • Loading branch information
rwightman authored Jan 15, 2025
2 parents 63b2de7 + 4779063 commit c96e9e7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@
help='include the class index in results')
parser.add_argument('--exclude-output', action='store_true', default=False,
help='exclude logits/probs from results, just indices. topk must be set !=0.')
parser.add_argument('--no-console-results', action='store_true', default=False,
help='disable printing the inference results to the console')


def main():
Expand Down Expand Up @@ -348,8 +350,9 @@ def main():
for fmt in args.results_format:
save_results(df, results_filename, fmt)

print(f'--result')
print(df.set_index(args.filename_col).to_json(orient='index', indent=4))
if not args.no_console_results:
print(f'--result')
print(df.set_index(args.filename_col).to_json(orient='index', indent=4))


def save_results(df, results_filename, results_format='csv', filename_col='filename'):
Expand Down

0 comments on commit c96e9e7

Please sign in to comment.