-
Notifications
You must be signed in to change notification settings - Fork 18
/
run_model.py
26 lines (21 loc) · 878 Bytes
/
run_model.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
import sys
import json
import argparse
sys.path.append("./src")
from annotate_question import annotate_question
from evaluate_question import main
parser = argparse.ArgumentParser()
parser.add_argument('-config_path', default = "config/model_config.json",
help='Path to the config file.')
parser.add_argument('-question', required = True,
help='Natural language question for the database.')
args = parser.parse_args()
with open(args.config_path, 'r') as f:
con = json.load(f)
anno_filename, headers = annotate_question(
args.question, con["table_id"], con["dir_in"], con["dir_out"], "test")
args = ['-model_path', con["model"], '-data_path', con["data_path"], \
"-anno_data_path", con["anno_path"]]
sql_code, result_list = main(anno_filename, headers, args)
print("SQL code:", sql_code)
print("Execution result:", ', '.join([str(x) for x in result_list]))