def index(): global extract_feature global generate_poem extract_feature = nn_process.create('extract_feature') generate_poem = nn_process.create('generate_poem') return render_template('index.html')
import nn_process import time import os import sys print('Loading Extracting Feature Module...') extract_feature = nn_process.create('extract_feature') print('Loading Generating Poem Module...') generate_poem = nn_process.create('generate_poem') # default path to an image DEFAULT_PATH = '' if sys.version_info[0] >= 3: raw_input = input else: FileNotFoundError = IOError def get_poem(image_file): """Generate a poem from the image whose filename is `image_file` Parameters ---------- image_file : str Path to the input image Returns ------- str Generated Poem