Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

calc-cylinder-volume.py 498 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  1. #!/usr/bin/env python3
  2. import sys
  3. import json
  4. from dagshub import dagshub_logger
  5. def calc_volume(radius: float, height: float) -> float:
  6. return 3.1415926 * radius * radius * height
  7. input_file, output_file = sys.argv[1:]
  8. with open(input_file) as f:
  9. param_dict = json.load(f)
  10. volume = calc_volume(param_dict['radius'], param_dict['height'])
  11. with dagshub_logger(metrics_path=output_file, should_log_hparams=False) as logger:
  12. logger.log_metrics({'volume': int(volume)}, step_num=1)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...