{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "id": "JKTCrY9LU7Oq" }, "outputs": [], "source": [ "##~ WIDGET CODE | BY: ANXETY ~##\n", "\n", "import os\n", "import json\n", "import time\n", "from ipywidgets import widgets\n", "from IPython.display import display, HTML, Javascript, clear_output\n", "\n", "\n", "# Setup Env\n", "env = os.getenv('ENV_NAME')\n", "root_path = os.getenv('ROOT_PATH')\n", "webui_path = os.getenv('WEBUI_PATH')\n", "free_plan = os.getenv('FREE_PLAN')\n", "\n", "\n", "# ==================== CSS JS ====================\n", "##~ custom background images V1.5 ~##\n", "import argparse\n", "parser = argparse.ArgumentParser(description='This script processes an background image.')\n", "parser.add_argument('-i', '--image', type=str, help='URL of the image to process', metavar='')\n", "parser.add_argument('-o', '--opacity', type=float, help='Opacity level for the image, between 0 and 1', metavar='', default=0.3)\n", "parser.add_argument('-b', '--blur', type=str, help='Blur level for the image', metavar='', default=0)\n", "parser.add_argument('-y', type=int, help='Y coordinate for the image in px', metavar='', default=0)\n", "parser.add_argument('-x', type=int, help='X coordinate for the image in px', metavar='', default=0)\n", "parser.add_argument('-s', '--scale', type=int, help='Scale image in %%', metavar='', default=100)\n", "parser.add_argument('-m', '--mode', action='store_true', help='Removes repetitive image tiles')\n", "parser.add_argument('-t', '--transparent', action='store_true', help='Makes input/selection fields 35%% more transparent')\n", "parser.add_argument('-bf', '--blur-fields', type=str, help='Background blur level for input/selection fields', metavar='', default=2)\n", "\n", "args = parser.parse_args()\n", "\n", "url_img = args.image\n", "opacity_img = args.opacity\n", "blur_img = args.blur\n", "y_img = args.y\n", "x_img = args.x\n", "scale_img = args.scale\n", "blur_fields = args.blur_fields\n", "\n", "## ---\n", "\"\"\" WTF KAGGLE - WHAT THE FUCK IS THE DIFFERENCE OF 35 PIXELS!?!?!? \"\"\"\n", "fix_heigh_img = \"-810px\" if env == \"Kaggle\" else \"-775px\"\n", "\n", "\"\"\" transperent fields \"\"\"\n", "t_bg_alpha = \"1\" if not args.transparent else \"0.65\"\n", "\n", "\"\"\" mode img - repeats \"\"\"\n", "mode_img = \"repeat\" if not args.mode else \"no-repeat\"\n", "\n", "container_background = f'''\n", "\"))\n", "\n", "# Main JS\n", "JS = '''\n", "\n", "\n", "'''\n", "display(HTML(JS))\n", "\n", "\n", "# ==================== WIDGETS V2 ====================\n", "HR = widgets.HTML('