diff --git a/handler.py b/handler.py index c0a908b..e361aa2 100644 --- a/handler.py +++ b/handler.py @@ -23,6 +23,12 @@ img = np.array(Image.open(in_PATH).convert('RGB'))[np.newaxis] / 255.0 img_p = util.preprocess_images_outpainting(img) return img_p + +def image_to_path(img): + resize_img = img + path = uuid.uuid4().hex + '.png' + resize_img.save(path) + return path @run_time def inference(model_PATH, img_p): @@ -50,6 +56,6 @@ base64_str = conf['Photo'] image = load_demo_image(base64_str, image_size, device) res = inference(model_PATH, image) - # add your code + image_str = image_to_path(res) return {'Output': res} diff --git a/src/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/src/.ipynb_checkpoints/Untitled-checkpoint.ipynb index b90f667..21a6d1e 100644 --- a/src/.ipynb_checkpoints/Untitled-checkpoint.ipynb +++ b/src/.ipynb_checkpoints/Untitled-checkpoint.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "04c7f16a", + "id": "a0f197c0", "metadata": {}, "outputs": [ { @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "0dd13c75", + "id": "35638e2a", "metadata": {}, "outputs": [], "source": [ @@ -50,7 +50,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "649a883e", + "id": "bfa0229a", "metadata": {}, "outputs": [], "source": [ @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "fba4c6ff", + "id": "57494ceb", "metadata": {}, "outputs": [], "source": [ @@ -79,8 +79,22 @@ }, { "cell_type": "code", + "execution_count": 11, + "id": "d1ab22e6", + "metadata": {}, + "outputs": [], + "source": [ + "def image_to_path(img):\n", + " resize_img = img\n", + " path = uuid.uuid4().hex + '.png'\n", + " resize_img.save(path)\n", + " return path" + ] + }, + { + "cell_type": "code", "execution_count": 6, - "id": "ff900f2b", + "id": "4a7370fa", "metadata": {}, "outputs": [], "source": [ @@ -101,8 +115,8 @@ }, { "cell_type": "code", - "execution_count": 10, - "id": "9d164058", + "execution_count": 12, + "id": "b03bba02", "metadata": {}, "outputs": [], "source": [ @@ -118,7 +132,7 @@ " base64_str = conf['Photo']\n", " image = load_demo_image(base64_str, image_size, device)\n", " res = inference(model_PATH, image)\n", - " # add your code\n", + " image_str = image_to_path(res)\n", " return {'Output': res}\n", " " ] diff --git a/src/Untitled.ipynb b/src/Untitled.ipynb index d8f03c5..cdb0b6b 100644 --- a/src/Untitled.ipynb +++ b/src/Untitled.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "755152e5", + "id": "29291686", "metadata": {}, "outputs": [ { @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "c45b2ba8", + "id": "67b9aae4", "metadata": {}, "outputs": [], "source": [ @@ -50,7 +50,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "7eb0351a", + "id": "058a509a", "metadata": {}, "outputs": [], "source": [ @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "196069cc", + "id": "7dd82ead", "metadata": {}, "outputs": [], "source": [ @@ -79,8 +79,22 @@ }, { "cell_type": "code", + "execution_count": 11, + "id": "379d2efd", + "metadata": {}, + "outputs": [], + "source": [ + "def image_to_path(img):\n", + " resize_img = img\n", + " path = uuid.uuid4().hex + '.png'\n", + " resize_img.save(path)\n", + " return path" + ] + }, + { + "cell_type": "code", "execution_count": 6, - "id": "e0a075d4", + "id": "70d5031c", "metadata": {}, "outputs": [], "source": [ @@ -101,8 +115,8 @@ }, { "cell_type": "code", - "execution_count": 10, - "id": "c7dfafbb", + "execution_count": 12, + "id": "d7439afa", "metadata": {}, "outputs": [], "source": [ @@ -118,7 +132,7 @@ " base64_str = conf['Photo']\n", " image = load_demo_image(base64_str, image_size, device)\n", " res = inference(model_PATH, image)\n", - " # add your code\n", + " image_str = image_to_path(res)\n", " return {'Output': res}\n", " " ]