def call_backend(filename):
    # Connect to the matlab backend.
    blub = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    blub.connect(('localhost', 60000))
    # Send query.
    ch = ConnectionHandler(blub)
    ch.send(filename)
    return ch.recv()
def call_backend(filename):
    # Connect to the matlab backend.
    blub = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    blub.connect(('localhost', 60000))
    # Send query.
    ch = ConnectionHandler(blub)
    ch.send(filename)
    return ch.recv()
Exemplo n.º 3
0
def AddHundred(num):
    # Connect to the matlab backend.
    blub = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    blub.connect(('localhost', 60000))

    # Send query.
    ch = ConnectionHandler(blub)
    ch.send(num)

    # Display the result.
    return ch.recv()
def AddHundred(num):
    # Connect to the matlab backend.
    blub = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    blub.connect(('localhost', 60000))

    # Send query.
    ch = ConnectionHandler(blub)
    ch.send(num)

    # Display the result.
    return ch.recv()
def AddHundred(num):
    # Connect to the matlab backend.
    blub = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    blub.connect(('localhost', 60000))

    # Send query.
    ch = ConnectionHandler(blub)
    ch.send(num)

    # Display the result.
    json_list = ch.recv()
    print json_list
    return json.dumps(json_list, separators=(',', ':'))
def AddHundred(num):
    # Connect to the matlab backend.
    blub = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    blub.connect(('localhost', 60000))

    # Send query.
    ch = ConnectionHandler(blub)
    ch.send(num)

    # Display the result.
    json_list = ch.recv()
    print json_list
    return json.dumps(json_list, separators=(',',':'))
    def handle(self):
        connectionHandler = ConnectionHandler(self.request)
        data = connectionHandler.recv()

        start = time.time()

        # Run classification script
        ranking = mlab.server_classification(data, self.server.weight_matrix, self.server.net)

        connectionHandler.send(str(gen_json(ranking)))

        t = time.time() - start

        print('Finished processing. Required %f seconds.' % t)
  def handle(self):
    connectionHandler = ConnectionHandler(self.request)
    data = connectionHandler.recv()

    start = time.time()

    # TODO(James): Add your classification code here...
    ranking = mlab.server_classification(data, self.server.weight_matrix, self.server.net)
    print('Ranking:')
    print(ranking)

    print(int(ranking[0]))
    connectionHandler.send(str(int(ranking[0])))

    # Use model via use_model.
    #output = mlab.use_model(self.server.model, int(data))
    #print('Output %d' % output)
    #connectionHandler.send('%d' % output)

    t = time.time() - start

    print('Finished processing. Required %f seconds.' % t)
Exemplo n.º 9
0
# Run this after launching the server. Server should say (1 + 100) = 101.

import socket
from ConnectionHandler import ConnectionHandler

# Connect to the matlab backend.
blub = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
blub.connect(('localhost', 60000))

# Send query.
ch = ConnectionHandler(blub)
ch.send('image_00001.jpg')
print 'Received %s' % ch.recv()