## //Vorst Cavry// ## import os import json import time import ipywidgets as widgets from ipywidgets import widgets, Layout, Label, Button, VBox, HBox from IPython.display import display, HTML, Javascript, clear_output # ================= DETECT ENV ================= def detect_environment(): free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20) environments = { 'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"), 'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content") } for env_var, (environment, path) in environments.items(): if env_var in os.environ: return environment, path, free_plan env, root_path, free_plan = detect_environment() webui_path = f"{root_path}/sdw" get_ipython().system('mkdir -p {root_path}') # ---------------------------------------------- # ==================== CSS JS ==================== # custom background images V1.5 import argparse parser = argparse.ArgumentParser(description='This script processes an background image.') parser.add_argument('-i', '--image', type=str, help='URL of the image to process', metavar='') parser.add_argument('-o', '--opacity', type=float, help='Opacity level for the image, between 0 and 1', metavar='', default=0.3) parser.add_argument('-b', '--blur', type=str, help='Blur level for the image', metavar='', default=0) parser.add_argument('-y', type=int, help='Y coordinate for the image in px', metavar='', default=0) parser.add_argument('-x', type=int, help='X coordinate for the image in px', metavar='', default=0) parser.add_argument('-s', '--scale', type=int, help='Scale image in %%', metavar='', default=100) parser.add_argument('-m', '--mode', action='store_true', help='Removes repetitive image tiles') parser.add_argument('-t', '--transparent', action='store_true', help='Makes input/selection fields 35%% more transparent') parser.add_argument('-bf', '--blur-fields', type=str, help='Background blur level for input/selection fields', metavar='', default=2) args = parser.parse_args() """---""" url_img = args.image opacity_img = args.opacity blur_img = args.blur y_img = args.y x_img = args.x scale_img = args.scale blur_fields = args.blur_fields ## --- """ WTF KAGGLE - WHAT THE FUCK IS THE DIFFERENCE OF 35 PIXELS!?!?!? """ fix_heigh_img = "-810px" if env == "Kaggle" else "-775px" """ transperent fields """ t_bg_alpha = "1" if not args.transparent else "0.65" """ mode img - repeats """ mode_img = "repeat" if not args.mode else "no-repeat" ## --- container_background = f''' ''' display(HTML(CSS)) # ==================== CSS JS ==================== # ==================== WIDGETS ==================== # --- global widgets --- style = {'description_width': 'initial'} layout = widgets.Layout(min_width='1047px') HR = widgets.HTML('