示例#1
0
from flask import Flask as fl, render_template, request, jsonify
import numpy as np
from Numerical_Method.numerical import Numerical
from Structured_Method_For_Platform.tool_for_freeman_code_gen import *
from Structured_Method_For_Platform.edit_distance_matrix_generation import *
from Autoencoders.network import *
import json
from flask import Response
import pandas as pd
from Sequence_Mining.sequence_mining import *
from Game.sudoku import *

#convert the image matrix to freeman code

app = fl(__name__)


@app.route('/')
def index():
    return render_template("index.html")


"""[API calls to recieve predictions]

[the methods identify_digit_numerical and identify_digit_structural will return the prediced digit
for the image matrix input]
"""


@app.route('/identify-digit-numerical', methods=['GET', 'POST'])
def identify_digit_numerical():
示例#2
0
from flask import Flask as fl
from flask import request, Response, render_template, jsonify
import MySQLdb as msql
import gevent
import gevent.monkey
from gevent.pywsgi import WSGIServer
from gevent.queue import Queue
import collections, json
from json import loads, dumps

app = fl(__name__)
def collect():
    con = msql.connect(host='localhost', user='******', passwd='password', db='discover')
    cur = con.cursor()
    check = "SHOW TABLES LIKE 'nodes'"
    cur.execute(check)
    result = cur.fetchone()
    if result:
        pass
    else:
        cur.execute('CREATE TABLE nodes (Id INTEGER NOT NULL AUTO_INCREMENT,Hostname VARCHAR(30), MAC_Addr VARCHAR(18),IP_Addr VARCHAR(15), OS VARCHAR(10),OS_Vrs VARCHAR(10), OS_Type VARCHAR(30),OS_Acc VARCHAR(3),PRIMARY KEY (Id))')
    cur.execute('SELECT * from nodes')
    node_data = cur.fetchall()
    return node_data

def collect_and_sort():    
    node_data = collect()
    dictionary = collections.OrderedDict()
    dt={}   
    count = 0
    while True: