mirror of
https://github.com/clearml/clearml
synced 2025-06-26 18:16:07 +00:00
Add Python Fire support (#550)
This commit is contained in:
committed by
GitHub
parent
9794135aed
commit
296cb7d899
19
examples/frameworks/fire/fire_object_cmd.py
Normal file
19
examples/frameworks/fire/fire_object_cmd.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# ClearML - Example of Python Fire integration, with commands derived from an object
|
||||
#
|
||||
from clearml import Task
|
||||
|
||||
import fire
|
||||
|
||||
|
||||
class Calculator(object):
|
||||
def add(self, x, y):
|
||||
return x + y
|
||||
|
||||
def multiply(self, x, y):
|
||||
return x * y
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Task.init(project_name="examples", task_name="fire object command")
|
||||
calculator = Calculator()
|
||||
fire.Fire(calculator)
|
||||
Reference in New Issue
Block a user