コード例 #1
0
def results():
    emotion = request.form["emotion"]
    quote = model.get_quote(emotion)
    imageSrc = model.get_image(emotion)
    return render_template('results.html',
                           quote=quote[0],
                           quoteAuthor=quote[1],
                           imgSrc=imageSrc,
                           time=datetime.now())
コード例 #2
0
def main():
    log(clear=True)
    print("Making ascii art out of {} with font {} \n".format(img_file, font_file))
    print("Making Font Features...")
    vocab, features = make_features(font_file,invert=False, layer_name=layer_name)
    print("Making ConvNet Model...")
    model = make_model(features, layer_name, pooling)
    print("Converting Image...")
    img = get_image(img_file)[None, ...]
    output = model.predict(img)
    correlated_pixels = np.argmax(output, axis=-1).squeeze()
    for row in range(0, correlated_pixels.shape[0], 2):
            line = ''
            for col in range(0, correlated_pixels.shape[1], 1):
                line += vocab[correlated_pixels[row, col]]
            print(line)
コード例 #3
0
ファイル: db.py プロジェクト: orez-/emoticon-tracker
def _to_row(emoticon):
    row = {
        'name': emoticon.name,
        'url': emoticon.url,
        'added_by': emoticon.added_by,
        'image': None,
        'added': None,
    }

    if emoticon.url.startswith('http'):
        image = model.get_image(emoticon.url)
        row.update({
            'image': image.raw_data,
            'added': image.created,
        })

    return row
コード例 #4
0
def execute_image_deallocation(name: str,
                               id: int,
                               new_name: str,
                               axis: int = 0) -> bool:
    """
    Executes image task with given data params, saves resulting images in directory and adds paths to meta.
    :param name: Name of image
    :param id: Id of image
    :param new_name: New  name of which image should be generated
    :param axis: 0 for horizontal and 1 for vertical
    :return: Boolean whether task was successful or not
    """
    data: Dict[str, any] = get_image(name, id)
    if data is None:
        return False
    imgs: List[ndarray] = deallocate_img(data, new_name, axis)
    directory: str = "new_img/%s/%i/%s/%i/" % (name, id, new_name, axis)
    directories: List[str] = save_images(imgs, directory)
    add_new_image(name, id, new_name, directories, axis)
    return True
コード例 #5
0
ファイル: Flask.py プロジェクト: SarveshSharma101/Webapp
def inference():
    global result
    image = model.get_image(fname)
    result, ic, p = l.predict(image)
    return redirect(url_for("index"))
コード例 #6
0
ファイル: handler.py プロジェクト: captainbrosset/buukkit
 def get(self, query_string):
     images = model.get_image_search_list(query_string)
     if len(images) > 0:
         respond_image(model.get_image(images[0]), self.response)
     else:
         self.redirect("/static/notfound.jpg")
コード例 #7
0
ファイル: handler.py プロジェクト: captainbrosset/buukkit
 def get(self, file_name):
     image = model.get_image(file_name)
     if image:
         respond_image(image, self.response)
     else:
         self.redirect("/static/unexplainable.jpg")