-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
43 lines (33 loc) · 1005 Bytes
/
Main.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
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 3 11:05:47 2020
@author: thunderspark
"""
import model
import pre_model
import integrator
def load_model():
data_path = input('Enter Path for Dataset: ')
pre_model.embed_file = input('\n\nEnter path for GloVe file: ')
model_obj=model.Model_class(data_path)
history, trained=model_obj.Model_train()
trained_json=trained.to_json()
with open('model_json.json','w') as json_file:
json_file.write(trained_json)
trained.save_weights('model.h5')
def test():
tweep=integrator.Integrator()
pred,tweets=tweep.tweet_analyser()
print('Here goes my hard work:')
for y,tweet in zip(pred,tweets):
print("{}, {}".format(y,tweet))
def main():
print('Type 1 for training model.\nType 2 for testing model. ')
choice=int(input())
if choice==1:
load_model()
else:
test()
if __name__=='__main__':
main()