{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a3eqLfJYwmTC",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "a3eqLfJYwmTC",
    "outputId": "6200b822-626e-401f-bd03-e2450450b2c1"
   },
   "outputs": [],
   "source": [
    "!pip install pornstar"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "legislative-crack",
   "metadata": {
    "id": "legislative-crack"
   },
   "source": [
    "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/yingshaoxo/pornstar/blob/master/example/colab.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "stunning-playing",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "stunning-playing",
    "outputId": "519a50b4-6da8-4f4b-8a33-443b1747a874"
   },
   "outputs": [],
   "source": [
    "import pornstar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "QF6Gm3TLw1Sy",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "QF6Gm3TLw1Sy",
    "outputId": "3258ae59-54fd-4614-dc72-d80788aeb6bd"
   },
   "outputs": [],
   "source": [
    "!wget https://github.com/yingshaoxo/pornstar/raw/master/example/girl.jpg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "EbA-wHzBxDiN",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "EbA-wHzBxDiN",
    "outputId": "e66383f8-4d87-432a-d8f0-a0791421e8ae"
   },
   "outputs": [],
   "source": [
    "!ls"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1ABWojERyFUs",
   "metadata": {
    "id": "1ABWojERyFUs"
   },
   "source": [
    "# add mask to your face"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "nbKx_ARHyArn",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 281
    },
    "id": "nbKx_ARHyArn",
    "outputId": "d5f3fc18-7fd0-4f2f-afc3-766833080c40"
   },
   "outputs": [],
   "source": [
    "input_img = \"girl.jpg\"\n",
    "frame = pornstar.utils.read_image_as_a_frame(input_img)\n",
    "frame = pornstar.effect_of_adding_a_mask_to_face(frame)\n",
    "pornstar.utils.display(frame)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9ouO8bhLxzLH",
   "metadata": {
    "id": "9ouO8bhLxzLH"
   },
   "source": [
    "# skin whitening"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "uGXC8fFixICS",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 684
    },
    "id": "uGXC8fFixICS",
    "outputId": "77da4283-dfae-40b0-cc17-f3dda4a2b2a3"
   },
   "outputs": [],
   "source": [
    "file_name = \"girl\"\n",
    "input_img = f\"./{file_name}.jpg\"\n",
    "output_img = f\"./{file_name}2.jpg\"\n",
    "\n",
    "raw = pornstar.utils.read_image_as_a_frame(input_img)\n",
    "\n",
    "frame = raw\n",
    "\n",
    "frame1 = pornstar.stylize_background_and_human_body(\n",
    "            frame,\n",
    "            [pornstar.effect_of_blur],\n",
    "            [pornstar.effect_of_whitening_with_a_top_layer]\n",
    "        )\n",
    "\n",
    "frame2 = pornstar.stylize_the_whole_image(\n",
    "            frame,\n",
    "            [pornstar.effect_of_whitening]\n",
    "        )\n",
    "\n",
    "frame3 = pornstar.stylize_the_whole_image(\n",
    "            frame,\n",
    "            [pornstar.effect_of_whitening_with_neural_network]\n",
    "        )\n",
    "\n",
    "pornstar.utils.display(\n",
    "        (\"raw\", raw), \n",
    "        (\"top_layer\", frame1), \n",
    "        (\"traditional algorithm\", frame2), \n",
    "        (\"neural_network\", frame3)\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8eifIxyyxi2m",
   "metadata": {
    "id": "8eifIxyyxi2m"
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "colab": {
   "name": "colab.ipynb",
   "provenance": [],
   "toc_visible": true
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
