def run(self):
     scrapper = Scrapper()
     global folder_path
     global test_df
     test_df = generate_test_data(self.username, self.threshold)
     folder_path = scrapper.dowload_data(self.username, self.threshold)
     #user_account="skyemcalpine"
     folder_path = folder_path.replace("\\", "/")
     print(folder_path)
     self.signals.result.emit(True)
 def test(self,username,threshold):
     scrapper=Scrapper()
     folder_path=scrapper.dowload_data(username,threshold)
     dataProcessor=DataProcessor(folder_path)
     data=dataProcessor.create_dataframe_input()
     #print(data)
     class_names=['food and drink', 'entertainment', 'business and industry', 'family and relationships', 'fitness and wellness', 'hobbies and activities', 'shopping and  fashion', 'sports and outdoors', 'technology']
     model_path="./last_cnn_model.h5"
     cnnModel=CnnModel(class_names,model_path,data)
     model=cnnModel.load_model()
     test_generator=cnnModel.create_generator()
     prediction=cnnModel.getPrediction(model,test_generator)
     result=np.sum(prediction,axis=0)
     result*=(1/len(prediction))
     return result
Beispiel #3
0
from scrapper import Scrapper
from dataProcessor import DataProcessor
from cnnModel import CnnModel
import os
import numpy as np
scrapper = Scrapper()
username = "******"
threshold = 3
folder_path = scrapper.dowload_data(username, threshold)
dataProcessor = DataProcessor(folder_path)
data = dataProcessor.create_dataframe_input()
print(data)
class_names = [
    'food and drink', 'entertainment', 'business and industry',
    'family and relationships', 'fitness and wellness',
    'hobbies and activities', 'shopping and  fashion', 'sports and outdoors',
    'technology'
]
model_path = "./last_cnn_model.h5"
cnnModel = CnnModel(class_names, model_path, data)
#cnnModel.visualise_data()
model = cnnModel.load_model()
test_generator = cnnModel.create_generator()
prediction = cnnModel.getPrediction(model, test_generator)
print(prediction)
#prediction=[[0.2,0.5,0.3],[0.4,0.3,0.3]]
result = np.sum(prediction, axis=0)
result *= (1 / len(prediction))
print(result)