Ejemplo n.º 1
0
import cvfy

app = cvfy.register("gh:0.0.0.0:61369601:3000:8000")

@cvfy.crossdomain
@app.listen()
def getsizes():
    
    ## all data is received in sequence of listing in the input component
    ## all data is sent in sequence of listing in the output component
    
    ## receiving the data
    alltext = cvfy.getTextArray()
    allimages = cvfy.getImageArray()
    
    ## get size of both images
    size1 = str(len(allimages[0].read()))
    size2 = str(len(allimages[1].read()))
    
    ## sending back the data
    data1 = alltext[0] + ' ' + size1 + ' bytes'
    data2 = alltext[1] + ' ' + size2 + ' bytes'
    cvfy.sendTextArray([data1, data2])
    
    ## telling the APP server that request returned successfully -- important
    
    return 'OK'
    
## running the app
app.run()
Ejemplo n.º 2
0
import cv2
import cvfy

app = cvfy.register('gh:107.170.77.168:62213840:3000:8004')

@cvfy.crossdomain
@app.listen()
def grayscale():

    all_image_paths = cvfy.getImageArray() 
    
    image_1_path = all_image_paths[0]
        
    cvfy.sendTextArrayToTerminal(['Loading Image...'])
    image_1 = cv2.imread(image_1_path)

    cvfy.sendTextArrayToTerminal(['Image Loaded successfully']);

    gray_image_1 = cv2.cvtColor(image_1, cv2.COLOR_BGR2GRAY)

    cvfy.sendTextArrayToTerminal(['Converting RGB Image to Grayscale']);

    cvfy.sendImageArray([gray_image_1], mode = 'numpy_array')

    cvfy.sendTextArrayToTerminal([
        'Operation completed successfully',
        image_1_path
        ]);

    return 'OK'
Ejemplo n.º 3
0
import cvfy
import cv2

app = cvfy.register('nongh:0.0.0.0:8142133:5001:8001:0.0.0.0')

@cvfy.crossdomain
@app.listen()
def runner():
	cvfy.sendTextArrayToTerminal(['Before output is displayed'])
	cvfy.sendTextArray(['Hello World!']) # Hardcode Text Output
	cvfy.sendTextArrayToTerminal(['After output is displayed'])
	return 'OK'

app.run()
Ejemplo n.º 4
0
import cvfy
import cv2

app = cvfy.register('nongh:0.0.0.0:9106717:5001:8002:0.0.0.0:5001')

@cvfy.crossdomain
@app.listen()
def runner():

	cvfy.sendTextArrayToTerminal(['Before input is sent by user'])
	textdata = cvfy.getTextArray()

	cvfy.sendTextArray(textdata)
	cvfy.sendTextArrayToTerminal(['After output is displayed'])

	return 'OK'

app.run()
Ejemplo n.º 5
0
import cvfy
import predict
import hashlib

app = cvfy.register("nongh:0.0.0.0:5431785:5001:8000:0.0.0.0")

img_dict = {}


def md5(fname):
    hash_md5 = hashlib.md5()
    with open(fname, "rb") as f:
        for chunk in iter(lambda: f.read(4096), b""):
            hash_md5.update(chunk)
    return hash_md5.hexdigest()


@cvfy.crossdomain
@app.listen()
def runner():
    all_image_paths = cvfy.getImageArray()
    err_list = []

    if not all_image_paths:
        err_list.append("Please upload an image first")

    cvfy.sendTextArray(err_list)
    return 'OK'

    all_text = cvfy.getTextArray()
Ejemplo n.º 6
0
import cvfy

app = cvfy.register("nongh:0.0.0.0:4045468:5001:7001:0.0.0.0")


@cvfy.crossdomain
@app.listen()
def runner():

    cvfy.sendTextArrayToTerminal(['Fetching image........'])

    cvfy.sendImageArray(['/home/alekhya/123.jpg'],
                        mode='file_path')  # Hardcoded image

    cvfy.sendTextArrayToTerminal(['Done!'])

    return 'OK'


app.run()
Ejemplo n.º 7
0
import cvfy

app = cvfy.register('gh:107.170.77.168:60819434:3000:8000')

@cvfy.crossdomain
@app.listen()
def concat():
        
    ## receiving the data
    alltext = cvfy.getTextArray()
    
    ## processing the data
    joined_and_uppercase = (alltext[0] + ' ' + alltext[1]).upper()
    and_then_reversed = joined_and_uppercase[::-1]
    
    ## sending back the data
    cvfy.sendTextArray([joined_and_uppercase, and_then_reversed])
    return 'OK'
        
app.run()
Ejemplo n.º 8
0
import cv2
import cvfy

app = cvfy.register('nongh:0.0.0.0:1129210:5001:7002:0.0.0.0:5001')


@cvfy.crossdomain
@app.listen()
def grayscale():

    images = cvfy.getImageArray()  # From input image component

    image_i_path = images[0]

    cvfy.sendTextArrayToTerminal(['Loading Image............'])

    image_i = cv2.imread(image_i_path)

    #print type(image_i)

    gray_image_i = cv2.cvtColor(image_i, cv2.COLOR_BGR2GRAY)

    cvfy.sendTextArrayToTerminal(
        ['Converting RGB image to Grayscale.............'])

    cvfy.sendImageArray([gray_image_i], mode='numpy_array')

    cvfy.sendTextArrayToTerminal(['Done!'])

    return 'OK'