diff --git a/Untitled.ipynb b/Untitled.ipynb index 1c17091..a0093d1 100644 --- a/Untitled.ipynb +++ b/Untitled.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "820b3659", + "id": "2b480856", "metadata": {}, "outputs": [ { @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "778a8669", + "id": "ba1925fa", "metadata": {}, "outputs": [], "source": [ @@ -49,38 +49,21 @@ }, { "cell_type": "code", - "execution_count": 9, - "id": "2873f942", - "metadata": {}, - "outputs": [], - "source": [ - "import time\n", - "def run_time(func):\n", - " def inner(model, image, question):\n", - " back = func(model, image, question)\n", - " print(\"Runned time: {} s\".format(round((time.time() - t)/10, 3)))\n", - " return back\n", - " t = time.time()\n", - " return inner" - ] - }, - { - "cell_type": "code", "execution_count": 8, - "id": "40f61f2c", + "id": "20c88989", "metadata": {}, "outputs": [], "source": [ "def load_demo_image(in_PATH):\n", " img = np.array(Image.open(in_PATH).convert('RGB'))[np.newaxis] / 255.0\n", - " img_p = util.preprocess_images_outpainting(img)\n", + " img_p = src.util.preprocess_images_outpainting(img)\n", " return img_p" ] }, { "cell_type": "code", "execution_count": 11, - "id": "d4861188", + "id": "5d117d25", "metadata": {}, "outputs": [], "source": [ @@ -94,14 +77,13 @@ { "cell_type": "code", "execution_count": 6, - "id": "92005cf0", + "id": "de6b79ae", "metadata": {}, "outputs": [], "source": [ - "@run_time\n", "def inference(model_PATH, img_p):\n", " G_Z = tf.placeholder(tf.float32, shape=[None, IMAGE_SZ, IMAGE_SZ, 4], name='G_Z')\n", - " G_sample = model.generator(G_Z)\n", + " G_sample = src.model.generator(G_Z)\n", " \n", " saver = tf.train.Saver()\n", " with tf.Session() as sess:\n", @@ -116,7 +98,7 @@ { "cell_type": "code", "execution_count": 12, - "id": "5863f30d", + "id": "35c27191", "metadata": {}, "outputs": [], "source": [ diff --git a/handler.py b/handler.py index 229249c..3548bf8 100644 --- a/handler.py +++ b/handler.py @@ -10,18 +10,9 @@ model_PATH='/home/jovyan/work/src/output/models/model2000.ckpt' -import time -def run_time(func): - def inner(model, image, question): - back = func(model, image, question) - print("Runned time: {} s".format(round((time.time() - t)/10, 3))) - return back - t = time.time() - return inner - def load_demo_image(in_PATH): img = np.array(Image.open(in_PATH).convert('RGB'))[np.newaxis] / 255.0 - img_p = util.preprocess_images_outpainting(img) + img_p = src.util.preprocess_images_outpainting(img) return img_p def image_to_path(img): @@ -30,10 +21,9 @@ resize_img.save(path) return path -@run_time def inference(model_PATH, img_p): G_Z = tf.placeholder(tf.float32, shape=[None, IMAGE_SZ, IMAGE_SZ, 4], name='G_Z') - G_sample = model.generator(G_Z) + G_sample = src.model.generator(G_Z) saver = tf.train.Saver() with tf.Session() as sess: