forked from noahgift/Python-MLOps-Cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
executable file
·28 lines (22 loc) · 692 Bytes
/
cli.py
File metadata and controls
executable file
·28 lines (22 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python
import click
from mlib import predict
# var=
@click.command()
@click.option(
"--weight",
prompt="MLB Player Weight",
help="Pass in the weight of a MLB player to predict the height",
)
def predictcli(weight):
"""Predicts Height of an MLB player based on weight"""
result = predict(weight)
inches = result["height_inches"]
human_readable = result["height_human_readable"]
if int(inches) > 72:
click.echo(click.style(human_readable, bg="green", fg="white"))
else:
click.echo(click.style(human_readable, bg="red", fg="white"))
if __name__ == "__main__":
# pylint: disable=no-value-for-parameter
predictcli()