-
Notifications
You must be signed in to change notification settings - Fork 0
/
project2.py
30 lines (20 loc) · 878 Bytes
/
project2.py
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
29
30
import argparse
import json
import predictor
def main(args):
try:
output = {}
# svc, nn = predictor.fit_prediction_models()
svc, nn = predictor.get_models()
output["cuisine"], output["score"] = predictor.find_cuisine(svc, args.ingredient)
output["closest"] = predictor.find_closest(nn, args.ingredient, args.N)
print(json.dumps(output, indent=2))
except BaseException as e:
# print("Something went wrong!!!")
print(e.with_traceback())
if __name__=='__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--N',required = True, type = int,help='Top N closest meals that are to be revealed')
parser.add_argument('--ingredient', required = True, type = str, action = "append", help='ingredients are to be inputted')
args = parser.parse_args()
main(args)