Spaces:
Build error
Build error
Duplicate from ivanmeyer/Finetuned_Diffusion_Max
Browse filesCo-authored-by: Ivan Meyer <[email protected]>
- .gitattributes +33 -0
- README.md +14 -0
- app.py +428 -0
- nsfw.png +0 -0
- requirements.txt +17 -0
- style.css +24 -0
- utils.py +6 -0
.gitattributes
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Finetuned Diffusion
|
| 3 |
+
emoji: 🪄🖼️
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 3.16.2
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: true
|
| 10 |
+
license: mit
|
| 11 |
+
duplicated_from: ivanmeyer/Finetuned_Diffusion_Max
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,428 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from diffusers import AutoencoderKL, UNet2DConditionModel, StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DPMSolverMultistepScheduler
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import torch
|
| 4 |
+
from PIL import Image
|
| 5 |
+
import utils
|
| 6 |
+
import datetime
|
| 7 |
+
import time
|
| 8 |
+
import psutil
|
| 9 |
+
import random
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
start_time = time.time()
|
| 13 |
+
is_colab = utils.is_google_colab()
|
| 14 |
+
state = None
|
| 15 |
+
current_steps = 25
|
| 16 |
+
|
| 17 |
+
class Model:
|
| 18 |
+
def __init__(self, name, path="", prefix=""):
|
| 19 |
+
self.name = name
|
| 20 |
+
self.path = path
|
| 21 |
+
self.prefix = prefix
|
| 22 |
+
self.pipe_t2i = None
|
| 23 |
+
self.pipe_i2i = None
|
| 24 |
+
|
| 25 |
+
models = [
|
| 26 |
+
Model("Dreamlike Diffusion 1.0", "dreamlike-art/dreamlike-diffusion-1.0", "dreamlikeart "),
|
| 27 |
+
Model("Dreamlike Photoreal 2.0", "dreamlike-art/dreamlike-photoreal-2.0", ""),
|
| 28 |
+
Model("Eimis Anime 1.0", "flax/EimisAnimeDiffusion_1.0v", ""),
|
| 29 |
+
Model("Eimis SemiRealistic", "eimiss/EimisSemiRealistic", ""),
|
| 30 |
+
Model("Portrait Plus", "wavymulder/portraitplus", "portrait+ style "),
|
| 31 |
+
Model("Protogen 5.3 (for plain realism, a bit bland)", "darkstorm2150/Protogen_v5.3_Official_Release", ""),
|
| 32 |
+
Model("Protogen 5.8 (for realism, but toward fantasy)", "darkstorm2150/Protogen_v5.8_Official_Release", ""),
|
| 33 |
+
Model("Protogen Dragon (for fantasy)", "darkstorm2150/Protogen_Dragon_Official_Release", ""),
|
| 34 |
+
Model("Protogen Nova (the all in one)", "darkstorm2150/Protogen_Nova_Official_Release", ""),
|
| 35 |
+
Model("Seek.Art Mega", "coreco/seek.art_MEGA", ""),
|
| 36 |
+
Model("Uber Realistic Porn Merge","PrimaPramudya/uberRealisticPrnMer_urpMv11", ""),
|
| 37 |
+
Model("Vintedois 0.1", "22h/vintedois-diffusion-v0-1", ""),
|
| 38 |
+
Model("Analog Diffusion", "wavymulder/Analog-Diffusion", "analog style "),
|
| 39 |
+
Model("Anything V3", "Linaqruf/anything-v3.0", ""),
|
| 40 |
+
Model("Arcane", "nitrosocke/Arcane-Diffusion", "arcane style "),
|
| 41 |
+
Model("Archer", "nitrosocke/archer-diffusion", "archer style "),
|
| 42 |
+
Model("Cyberpunk Anime", "DGSpitzer/Cyberpunk-Anime-Diffusion", "dgs illustration style "),
|
| 43 |
+
Model("Disney, modern", "nitrosocke/mo-di-diffusion", "modern disney style "),
|
| 44 |
+
Model("Disney, Classic", "nitrosocke/classic-anim-diffusion", "classic disney style "),
|
| 45 |
+
Model("DnD Item", "stale2000/sd-dnditem", "dnditem "),
|
| 46 |
+
Model("Elden Ring", "nitrosocke/elden-ring-diffusion", "elden ring style "),
|
| 47 |
+
Model("f222 Zeipfher", "m4gnett/zeipher-f222", ""),
|
| 48 |
+
Model("f222 + Anything V3", "m4gnett/anything-of-f222", ""),
|
| 49 |
+
Model("Loving Vincent (Van Gogh)", "dallinmackay/Van-Gogh-diffusion", "lvngvncnt "),
|
| 50 |
+
Model("Midjourney v4 style", "prompthero/openjourney", "mdjrny-v4 style "),
|
| 51 |
+
Model("Pokémon", "lambdalabs/sd-pokemon-diffusers"),
|
| 52 |
+
Model("Pony Diffusion", "AstraliteHeart/pony-diffusion"),
|
| 53 |
+
Model("Redshift renderer (Cinema4D)", "nitrosocke/redshift-diffusion", "redshift style "),
|
| 54 |
+
Model("Robo Diffusion", "nousr/robo-diffusion"),
|
| 55 |
+
Model("Spider-Verse", "nitrosocke/spider-verse-diffusion", "spiderverse style "),
|
| 56 |
+
Model("TrinArt v2", "naclbit/trinart_stable_diffusion_v2"),
|
| 57 |
+
Model("Tron Legacy", "dallinmackay/Tron-Legacy-diffusion", "trnlgcy "),
|
| 58 |
+
Model("Waifu", "hakurei/waifu-diffusion"),
|
| 59 |
+
Model("Wavyfusion", "wavymulder/wavyfusion", "wa-vy style "),
|
| 60 |
+
Model("Balloon Art", "Fictiverse/Stable_Diffusion_BalloonArt_Model", "BalloonArt "),
|
| 61 |
+
Model("Anything V3 Better-Vae", "Linaqruf/anything-v3-better-vae", ""),
|
| 62 |
+
Model("Anything V4", "andite/anything-v4.0", ""),
|
| 63 |
+
Model("Cyberpunk Anime with Genshin Characters supported", "AdamOswald1/Cyberpunk-Anime-Diffusion_with_support_for_Gen-Imp_characters", "cyberpunk style"),
|
| 64 |
+
Model("Dark Souls", "Guizmus/DarkSoulsDiffusion", "dark souls style"),
|
| 65 |
+
Model("Space Machine", "rabidgremlin/sd-db-epic-space-machine", "EpicSpaceMachine"),
|
| 66 |
+
Model("Spacecraft", "rabidgremlin/sd-db-epic-space-machine, Guizmus/Tardisfusion", "EpicSpaceMachine, Tardis Box style"),
|
| 67 |
+
Model("TARDIS", "Guizmus/Tardisfusion", "Tardis Box style"),
|
| 68 |
+
Model("Modern Era TARDIS Interior", "Guizmus/Tardisfusion", "Modern Tardis style"),
|
| 69 |
+
Model("Classic Era TARDIS Interior", "Guizmus/Tardisfusion", "Classic Tardis style"),
|
| 70 |
+
Model("Spacecraft Interior", "Guizmus/Tardisfusion, rabidgremlin/sd-db-epic-space-machine", "Classic Tardis style, Modern Tardis style, EpicSpaceMachine"),
|
| 71 |
+
Model("CLIP", "EleutherAI/clip-guided-diffusion", "CLIP"),
|
| 72 |
+
Model("Genshin Waifu", "crumb/genshin-stable-inversion, yuiqena/GenshinImpact, katakana/2D-Mix, Guizmus/AnimeChanStyle", "Female, female, Woman, woman, Girl, girl"),
|
| 73 |
+
Model("Genshin", "crumb/genshin-stable-inversion, yuiqena/GenshinImpact, katakana/2D-Mix, Guizmus/AnimeChanStyle", ""),
|
| 74 |
+
Model("Test", "AdamOswald1/Idk", ""),
|
| 75 |
+
Model("Test2", "AdamOswald1/Tester", ""),
|
| 76 |
+
Model("Anime", "Guizmus/AnimeChanStyle, katakana/2D-Mix", ""),
|
| 77 |
+
Model("Beeple", "riccardogiorato/beeple-diffusion", "beeple style "),
|
| 78 |
+
Model("Avatar", "riccardogiorato/avatar-diffusion", "avatartwow style "),
|
| 79 |
+
Model("Poolsuite", "prompthero/poolsuite", "poolsuite style "),
|
| 80 |
+
Model("Epic Diffusion", "johnslegers/epic-diffusion", ""),
|
| 81 |
+
Model("Comic Diffusion", "ogkalu/Comic-Diffusion", ""),
|
| 82 |
+
Model("Realistic Vision 1.2", "SG161222/Realistic_Vision_V1.2", ""),
|
| 83 |
+
Model("Stable Diffusion 2.1", "stabilityai/stable-diffusion-2-1", ""),
|
| 84 |
+
Model("OrangeMixs", "WarriorMama777/OrangeMixs", "Abyss"),
|
| 85 |
+
Model("Inkpunk-Diffusion", "Envvi/Inkpunk-Diffusion", "nvinkpunk"),
|
| 86 |
+
Model("openjourney-v2", "prompthero/openjourney-v2", ""),
|
| 87 |
+
Model("hassenblend 1.4", "hassanblend/hassanblend1.4", ""),
|
| 88 |
+
Model("Cyberpunk-Anime-Diffusion", "DGSpitzer/Cyberpunk-Anime-Diffusion", "DGS Illustration style"),
|
| 89 |
+
Model("Ghibli-Diffusion", "nitrosocke/Ghibli-Diffusion", "ghibli style"),
|
| 90 |
+
Model("Pastel-Mix", "andite/pastel-mix", "mksks style"),
|
| 91 |
+
Model("trinart_stable_diffusion_v2", "naclbit/trinart_stable_diffusion_v2", ""),
|
| 92 |
+
Model("Counterfeit-V2.0", "gsdf/Counterfeit-V2.0", ""),
|
| 93 |
+
Model("stable diffusion 2.1 base", "stabilityai/stable-diffusion-2-1-base", ""),
|
| 94 |
+
Model("Double Exposure Diffusion", "joachimsallstrom/Double-Exposure-Diffusion", "dublex style, dublex"),
|
| 95 |
+
Model("Yohan Diffusion", "andite/yohan-diffusion", ""),
|
| 96 |
+
Model("rMadArt2.5", "rmada/rMadArt2.5", ""),
|
| 97 |
+
Model("unico", "Cinnamomo/unico", ""),
|
| 98 |
+
Model("Inizio", "Cinnamomo/inizio", ""),
|
| 99 |
+
Model("HARDblend", "theintuitiveye/HARDblend", "photorealistic, instagram photography, shot on iphone, RAW, professional photograph"),
|
| 100 |
+
Model("FantasyMix-v1", "theintuitiveye/FantasyMix-v1", ""),
|
| 101 |
+
Model("modernartstyle", "theintuitiveye/modernartstyle", "modernartst"),
|
| 102 |
+
Model("paint-jpurney-v2", "FredZhang7/paint-journey-v2", "oil painting"),
|
| 103 |
+
Model("Sygil-Diffusion", "Sygil/Sygil-Diffusion", ""),
|
| 104 |
+
Model("g_yuusukeStyle", "grullborg/g_yuusukeStyle", ""),
|
| 105 |
+
Model("th-diffusion", "furusu/th-diffusion", "realistic"),
|
| 106 |
+
Model("SD_Black_Ancient_Egyptian_Style", "Akumetsu971/SD_Black_Ancient_Egyptian_Style", "Bck_Egpt"),
|
| 107 |
+
Model("Shortjourney", "x67/shortjourney", "sjrny-v1 style"),
|
| 108 |
+
Model("Kenshi", "SweetLuna/Kenshi", ""),
|
| 109 |
+
Model("lomo-diffusion", "wavymulder/lomo-diffusion", "lomo style"),
|
| 110 |
+
Model("RainerMix", "Hemlok/RainierMix", ""),
|
| 111 |
+
Model("GuoFeng3", "xiaolxl/GuoFeng3", ""),
|
| 112 |
+
Model("sketchstyle-cutesexyrobutts", "Cosk/sketchstyle-cutesexyrobutts", ""),
|
| 113 |
+
Model("Counterfeit-V2.5", "gsdf/Counterfeit-V2.5", ""),
|
| 114 |
+
Model("TriPhaze", "Lucetepolis/TriPhaze", ""),
|
| 115 |
+
Model("SukiyakiMix-1.0", "Vsukiyaki/SukiyakiMix-v1.0", ""),
|
| 116 |
+
Model("icon-diffusion-v1-1", "crumb/icon-diffusion-v1-1", ""),
|
| 117 |
+
Model("Strange_Dedication", "MortalSage/Strange_Dedication", ""),
|
| 118 |
+
Model("openjourney-v2", "prompthero/openjourney-v2", ""),
|
| 119 |
+
Model("Funko-Diffusion", "prompthero/funko-diffusion", "funko style"),
|
| 120 |
+
Model("DreamShaper", "Lykon/DreamShaper", "dreamshaper"),
|
| 121 |
+
Model("Realistic_Vision_V1.4", "SG161222/Realistic_Vision_V1.4", ""),
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
]
|
| 128 |
+
|
| 129 |
+
custom_model = None
|
| 130 |
+
if is_colab:
|
| 131 |
+
models.insert(0, Model("Custom model"))
|
| 132 |
+
custom_model = models[0]
|
| 133 |
+
|
| 134 |
+
last_mode = "txt2img"
|
| 135 |
+
current_model = models[1] if is_colab else models[0]
|
| 136 |
+
current_model_path = current_model.path
|
| 137 |
+
|
| 138 |
+
if is_colab:
|
| 139 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
| 140 |
+
current_model.path,
|
| 141 |
+
torch_dtype=torch.float16,
|
| 142 |
+
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
|
| 143 |
+
safety_checker=None
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
else:
|
| 147 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
| 148 |
+
current_model.path,
|
| 149 |
+
torch_dtype=torch.float16,
|
| 150 |
+
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
|
| 151 |
+
)
|
| 152 |
+
|
| 153 |
+
if torch.cuda.is_available():
|
| 154 |
+
pipe = pipe.to("cuda")
|
| 155 |
+
pipe.enable_xformers_memory_efficient_attention()
|
| 156 |
+
|
| 157 |
+
device = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
|
| 158 |
+
|
| 159 |
+
def error_str(error, title="Error"):
|
| 160 |
+
return f"""#### {title}
|
| 161 |
+
{error}""" if error else ""
|
| 162 |
+
|
| 163 |
+
def update_state(new_state):
|
| 164 |
+
global state
|
| 165 |
+
state = new_state
|
| 166 |
+
|
| 167 |
+
def update_state_info(old_state):
|
| 168 |
+
if state and state != old_state:
|
| 169 |
+
return gr.update(value=state)
|
| 170 |
+
|
| 171 |
+
def custom_model_changed(path):
|
| 172 |
+
models[0].path = path
|
| 173 |
+
global current_model
|
| 174 |
+
current_model = models[0]
|
| 175 |
+
|
| 176 |
+
def on_model_change(model_name):
|
| 177 |
+
|
| 178 |
+
prefix = "Enter prompt. \"" + next((m.prefix for m in models if m.name == model_name), None) + "\" is prefixed automatically" if model_name != models[0].name else "Don't forget to use the custom model prefix in the prompt!"
|
| 179 |
+
|
| 180 |
+
return gr.update(visible = model_name == models[0].name), gr.update(placeholder=prefix)
|
| 181 |
+
|
| 182 |
+
def on_steps_change(steps):
|
| 183 |
+
global current_steps
|
| 184 |
+
current_steps = steps
|
| 185 |
+
|
| 186 |
+
def pipe_callback(step: int, timestep: int, latents: torch.FloatTensor):
|
| 187 |
+
update_state(f"{step}/{current_steps} steps")#\nTime left, sec: {timestep/100:.0f}")
|
| 188 |
+
|
| 189 |
+
def inference(model_name, prompt, guidance, steps, n_images=1, width=512, height=512, seed=0, img=None, strength=0.5, neg_prompt=""):
|
| 190 |
+
|
| 191 |
+
update_state(" ")
|
| 192 |
+
|
| 193 |
+
print(psutil.virtual_memory()) # print memory usage
|
| 194 |
+
|
| 195 |
+
global current_model
|
| 196 |
+
for model in models:
|
| 197 |
+
if model.name == model_name:
|
| 198 |
+
current_model = model
|
| 199 |
+
model_path = current_model.path
|
| 200 |
+
|
| 201 |
+
# generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
|
| 202 |
+
if seed == 0:
|
| 203 |
+
seed = random.randint(0, 2147483647)
|
| 204 |
+
|
| 205 |
+
generator = torch.Generator('cuda').manual_seed(seed)
|
| 206 |
+
|
| 207 |
+
try:
|
| 208 |
+
if img is not None:
|
| 209 |
+
return img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator, seed), f"Done. Seed: {seed}"
|
| 210 |
+
else:
|
| 211 |
+
return txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed), f"Done. Seed: {seed}"
|
| 212 |
+
except Exception as e:
|
| 213 |
+
return None, error_str(e)
|
| 214 |
+
|
| 215 |
+
def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed):
|
| 216 |
+
|
| 217 |
+
print(f"{datetime.datetime.now()} txt_to_img, model: {current_model.name}")
|
| 218 |
+
|
| 219 |
+
global last_mode
|
| 220 |
+
global pipe
|
| 221 |
+
global current_model_path
|
| 222 |
+
if model_path != current_model_path or last_mode != "txt2img":
|
| 223 |
+
current_model_path = model_path
|
| 224 |
+
|
| 225 |
+
update_state(f"Loading {current_model.name} text-to-image model...")
|
| 226 |
+
|
| 227 |
+
if is_colab or current_model == custom_model:
|
| 228 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
| 229 |
+
current_model_path,
|
| 230 |
+
torch_dtype=torch.float16,
|
| 231 |
+
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
|
| 232 |
+
safety_checker=None
|
| 233 |
+
)
|
| 234 |
+
else:
|
| 235 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
| 236 |
+
current_model_path,
|
| 237 |
+
torch_dtype=torch.float16,
|
| 238 |
+
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
|
| 239 |
+
)
|
| 240 |
+
# pipe = pipe.to("cpu")
|
| 241 |
+
# pipe = current_model.pipe_t2i
|
| 242 |
+
|
| 243 |
+
if torch.cuda.is_available():
|
| 244 |
+
pipe = pipe.to("cuda")
|
| 245 |
+
pipe.enable_xformers_memory_efficient_attention()
|
| 246 |
+
last_mode = "txt2img"
|
| 247 |
+
|
| 248 |
+
prompt = current_model.prefix + prompt
|
| 249 |
+
result = pipe(
|
| 250 |
+
prompt,
|
| 251 |
+
negative_prompt = neg_prompt,
|
| 252 |
+
num_images_per_prompt=n_images,
|
| 253 |
+
num_inference_steps = int(steps),
|
| 254 |
+
guidance_scale = guidance,
|
| 255 |
+
width = width,
|
| 256 |
+
height = height,
|
| 257 |
+
generator = generator,
|
| 258 |
+
callback=pipe_callback)
|
| 259 |
+
|
| 260 |
+
# update_state(f"Done. Seed: {seed}")
|
| 261 |
+
|
| 262 |
+
return replace_nsfw_images(result)
|
| 263 |
+
|
| 264 |
+
def img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator, seed):
|
| 265 |
+
|
| 266 |
+
print(f"{datetime.datetime.now()} img_to_img, model: {model_path}")
|
| 267 |
+
|
| 268 |
+
global last_mode
|
| 269 |
+
global pipe
|
| 270 |
+
global current_model_path
|
| 271 |
+
if model_path != current_model_path or last_mode != "img2img":
|
| 272 |
+
current_model_path = model_path
|
| 273 |
+
|
| 274 |
+
update_state(f"Loading {current_model.name} image-to-image model...")
|
| 275 |
+
|
| 276 |
+
if is_colab or current_model == custom_model:
|
| 277 |
+
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
|
| 278 |
+
current_model_path,
|
| 279 |
+
torch_dtype=torch.float16,
|
| 280 |
+
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
|
| 281 |
+
safety_checker=None
|
| 282 |
+
)
|
| 283 |
+
else:
|
| 284 |
+
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
|
| 285 |
+
current_model_path,
|
| 286 |
+
torch_dtype=torch.float16,
|
| 287 |
+
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
|
| 288 |
+
)
|
| 289 |
+
# pipe = pipe.to("cpu")
|
| 290 |
+
# pipe = current_model.pipe_i2i
|
| 291 |
+
|
| 292 |
+
if torch.cuda.is_available():
|
| 293 |
+
pipe = pipe.to("cuda")
|
| 294 |
+
pipe.enable_xformers_memory_efficient_attention()
|
| 295 |
+
last_mode = "img2img"
|
| 296 |
+
|
| 297 |
+
prompt = current_model.prefix + prompt
|
| 298 |
+
ratio = min(height / img.height, width / img.width)
|
| 299 |
+
img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
|
| 300 |
+
result = pipe(
|
| 301 |
+
prompt,
|
| 302 |
+
negative_prompt = neg_prompt,
|
| 303 |
+
num_images_per_prompt=n_images,
|
| 304 |
+
image = img,
|
| 305 |
+
num_inference_steps = int(steps),
|
| 306 |
+
strength = strength,
|
| 307 |
+
guidance_scale = guidance,
|
| 308 |
+
# width = width,
|
| 309 |
+
# height = height,
|
| 310 |
+
generator = generator,
|
| 311 |
+
callback=pipe_callback)
|
| 312 |
+
|
| 313 |
+
# update_state(f"Done. Seed: {seed}")
|
| 314 |
+
|
| 315 |
+
return replace_nsfw_images(result)
|
| 316 |
+
|
| 317 |
+
def replace_nsfw_images(results):
|
| 318 |
+
|
| 319 |
+
if is_colab:
|
| 320 |
+
return results.images
|
| 321 |
+
|
| 322 |
+
for i in range(len(results.images)):
|
| 323 |
+
if results.nsfw_content_detected[i]:
|
| 324 |
+
results.images[i] = Image.open("nsfw.png")
|
| 325 |
+
return results.images
|
| 326 |
+
|
| 327 |
+
# css = """.finetuned-diffusion-div div{display:inline-flex;align-items:center;gap:.8rem;font-size:1.75rem}.finetuned-diffusion-div div h1{font-weight:900;margin-bottom:7px}.finetuned-diffusion-div p{margin-bottom:10px;font-size:94%}a{text-decoration:underline}.tabs{margin-top:0;margin-bottom:0}#gallery{min-height:20rem}
|
| 328 |
+
# """
|
| 329 |
+
with gr.Blocks(css="style.css") as demo:
|
| 330 |
+
gr.HTML(
|
| 331 |
+
f"""
|
| 332 |
+
<div class="Finetuned-Diffusion-Max-div">
|
| 333 |
+
<div>
|
| 334 |
+
<h1>Finetuned Diffusion Max</h1>
|
| 335 |
+
</div>
|
| 336 |
+
<p>
|
| 337 |
+
Demo for multiple fine-tuned Stable Diffusion models, trained on different styles: <br>
|
| 338 |
+
<a href="https://huggingface.co/nitrosocke/Arcane-Diffusion">Arcane</a>, <a href="https://huggingface.co/nitrosocke/archer-diffusion">Archer</a>, <a href="https://huggingface.co/nitrosocke/elden-ring-diffusion">Elden Ring</a>, <a href="https://huggingface.co/nitrosocke/spider-verse-diffusion">Spider-Verse</a>, <a href="https://huggingface.co/nitrosocke/mo-di-diffusion">Modern Disney</a>, <a href="https://huggingface.co/nitrosocke/classic-anim-diffusion">Classic Disney</a>, <a href="https://huggingface.co/dallinmackay/Van-Gogh-diffusion">Loving Vincent (Van Gogh)</a>, <a href="https://huggingface.co/nitrosocke/redshift-diffusion">Redshift renderer (Cinema4D)</a>, <a href="https://huggingface.co/prompthero/midjourney-v4-diffusion">Midjourney v4 style</a>, <a href="https://huggingface.co/hakurei/waifu-diffusion">Waifu</a>, <a href="https://huggingface.co/lambdalabs/sd-pokemon-diffusers">Pokémon</a>, <a href="https://huggingface.co/AstraliteHeart/pony-diffusion">Pony Diffusion</a>, <a href="https://huggingface.co/nousr/robo-diffusion">Robo Diffusion</a>, <a href="https://huggingface.co/DGSpitzer/Cyberpunk-Anime-Diffusion">Cyberpunk Anime</a>, <a href="https://huggingface.co/dallinmackay/Tron-Legacy-diffusion">Tron Legacy</a>, <a href="https://huggingface.co/Fictiverse/Stable_Diffusion_BalloonArt_Model">Balloon Art</a> + in colab notebook you can load any other Diffusers 🧨 SD model hosted on HuggingFace 🤗.
|
| 339 |
+
</p>
|
| 340 |
+
<p>You can skip the queue and load custom models in the colab: <a href="https://colab.research.google.com/gist/shanks125/ea9bf3a133ce53f2c7c31884a1473d80/copy-of-fine-tuned-diffusion-gradio.ipynb"><img data-canonical-src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" src="https://camo.githubusercontent.com/84f0493939e0c4de4e6dbe113251b4bfb5353e57134ffd9fcab6b8714514d4d1/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667"></a></p>
|
| 341 |
+
Running on <b>{device}</b>{(" in a <b>Google Colab</b>." if is_colab else "")}
|
| 342 |
+
</p>
|
| 343 |
+
<p>You can also duplicate this space and upgrade to gpu by going to settings:<br>
|
| 344 |
+
<a style="display:inline-block" href="https://huggingface.co/spaces/SUPERSHANKY/Finetuned_Diffusion_Max/?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></p>
|
| 345 |
+
</div>
|
| 346 |
+
"""
|
| 347 |
+
)
|
| 348 |
+
with gr.Row():
|
| 349 |
+
|
| 350 |
+
with gr.Column(scale=55):
|
| 351 |
+
with gr.Group():
|
| 352 |
+
model_name = gr.Dropdown(label="Model", choices=[m.name for m in models], value=current_model.name)
|
| 353 |
+
with gr.Box(visible=False) as custom_model_group:
|
| 354 |
+
custom_model_path = gr.Textbox(label="Custom model path", placeholder="Path to model, e.g. nitrosocke/Arcane-Diffusion", interactive=True)
|
| 355 |
+
gr.HTML("<div><font size='2'>Custom models have to be downloaded first, so give it some time.</font></div>")
|
| 356 |
+
|
| 357 |
+
with gr.Row():
|
| 358 |
+
prompt = gr.Textbox(label="Prompt", show_label=False, max_lines=2,placeholder="Enter prompt. Style applied automatically").style(container=False)
|
| 359 |
+
generate = gr.Button(value="Generate").style(rounded=(False, True, True, False))
|
| 360 |
+
|
| 361 |
+
|
| 362 |
+
# image_out = gr.Image(height=512)
|
| 363 |
+
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
| 364 |
+
|
| 365 |
+
state_info = gr.Textbox(label="State", show_label=False, max_lines=2).style(container=False)
|
| 366 |
+
error_output = gr.Markdown()
|
| 367 |
+
|
| 368 |
+
with gr.Column(scale=45):
|
| 369 |
+
with gr.Tab("Options"):
|
| 370 |
+
with gr.Group():
|
| 371 |
+
neg_prompt = gr.Textbox(label="Negative prompt", placeholder="What to exclude from the image")
|
| 372 |
+
|
| 373 |
+
n_images = gr.Slider(label="Images", value=1, minimum=1, maximum=10, step=1)
|
| 374 |
+
|
| 375 |
+
with gr.Row():
|
| 376 |
+
guidance = gr.Slider(label="Guidance scale", value=7.5, maximum=15)
|
| 377 |
+
steps = gr.Slider(label="Steps", value=current_steps, minimum=2, maximum=250, step=1)
|
| 378 |
+
|
| 379 |
+
with gr.Row():
|
| 380 |
+
width = gr.Slider(label="Width", value=512, minimum=64, maximum=2048, step=8)
|
| 381 |
+
height = gr.Slider(label="Height", value=512, minimum=64, maximum=2048, step=8)
|
| 382 |
+
|
| 383 |
+
seed = gr.Slider(0, 2147483647, label='Seed (0 = random)', value=0, step=1)
|
| 384 |
+
|
| 385 |
+
with gr.Tab("Image to image"):
|
| 386 |
+
with gr.Group():
|
| 387 |
+
image = gr.Image(label="Image", height=256, tool="editor", type="pil")
|
| 388 |
+
strength = gr.Slider(label="Transformation strength", minimum=0, maximum=1, step=0.01, value=0.5)
|
| 389 |
+
|
| 390 |
+
if is_colab:
|
| 391 |
+
model_name.change(on_model_change, inputs=model_name, outputs=[custom_model_group, prompt], queue=False)
|
| 392 |
+
custom_model_path.change(custom_model_changed, inputs=custom_model_path, outputs=None)
|
| 393 |
+
# n_images.change(lambda n: gr.Gallery().style(grid=[2 if n > 1 else 1], height="auto"), inputs=n_images, outputs=gallery)
|
| 394 |
+
steps.change(on_steps_change, inputs=[steps], outputs=[], queue=False)
|
| 395 |
+
|
| 396 |
+
inputs = [model_name, prompt, guidance, steps, n_images, width, height, seed, image, strength, neg_prompt]
|
| 397 |
+
outputs = [gallery, error_output]
|
| 398 |
+
prompt.submit(inference, inputs=inputs, outputs=outputs)
|
| 399 |
+
generate.click(inference, inputs=inputs, outputs=outputs)
|
| 400 |
+
|
| 401 |
+
ex = gr.Examples([
|
| 402 |
+
[models[7].name, "tiny cute and adorable kitten adventurer dressed in a warm overcoat with survival gear on a winters day", 7.5, 25],
|
| 403 |
+
[models[4].name, "portrait of dwayne johnson", 7.0, 35],
|
| 404 |
+
[models[5].name, "portrait of a beautiful alyx vance half life", 10, 25],
|
| 405 |
+
[models[6].name, "Aloy from Horizon: Zero Dawn, half body portrait, smooth, detailed armor, beautiful face, illustration", 7.0, 30],
|
| 406 |
+
[models[5].name, "fantasy portrait painting, digital art", 4.0, 20],
|
| 407 |
+
], inputs=[model_name, prompt, guidance, steps], outputs=outputs, fn=inference, cache_examples=False)
|
| 408 |
+
|
| 409 |
+
gr.HTML("""
|
| 410 |
+
<div style="border-top: 1px solid #303030;">
|
| 411 |
+
<br>
|
| 412 |
+
<p>Models by <a href="https://huggingface.co/nitrosocke">@nitrosocke</a>, <a href="https://twitter.com/haruu1367">@haruu1367</a>, <a href="https://twitter.com/DGSpitzer">@Helixngc7293</a>, <a href="https://twitter.com/dal_mack">@dal_mack</a>, <a href="https://twitter.com/prompthero">@prompthero</a> and others. ❤️</p>
|
| 413 |
+
<p>This space uses the <a href="https://github.com/LuChengTHU/dpm-solver">DPM-Solver++</a> sampler by <a href="https://arxiv.org/abs/2206.00927">Cheng Lu, et al.</a>.</p>
|
| 414 |
+
<p>Space by:<br>
|
| 415 |
+
<a href="https://twitter.com/hahahahohohe"><img src="https://img.shields.io/twitter/follow/hahahahohohe?label=%40anzorq&style=social" alt="Twitter Follow"></a><br>
|
| 416 |
+
<a href="https://github.com/qunash"><img alt="GitHub followers" src="https://img.shields.io/github/followers/qunash?style=social" alt="Github Follow"></a></p><br><br>
|
| 417 |
+
<a href="https://www.buymeacoffee.com/anzorq" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 45px !important;width: 162px !important;" ></a><br><br>
|
| 418 |
+
<p><img src="https://visitor-badge.glitch.me/badge?page_id=anzorq.finetuned_diffusion" alt="visitors"></p>
|
| 419 |
+
</div>
|
| 420 |
+
""")
|
| 421 |
+
|
| 422 |
+
demo.load(update_state_info, inputs=state_info, outputs=state_info, every=0.5, show_progress=False)
|
| 423 |
+
|
| 424 |
+
print(f"Space built in {time.time() - start_time:.2f} seconds")
|
| 425 |
+
|
| 426 |
+
# if not is_colab:
|
| 427 |
+
demo.queue(concurrency_count=1)
|
| 428 |
+
demo.launch(debug=is_colab, share=is_colab)
|
nsfw.png
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--extra-index-url https://download.pytorch.org/whl/cu117
|
| 2 |
+
torch
|
| 3 |
+
https://download.pytorch.org/whl/cu117/torch-1.13.1%2Bcu117-cp38-cp38-linux_x86_64.whl
|
| 4 |
+
torchvision==0.14.1+cu117
|
| 5 |
+
#diffusers
|
| 6 |
+
git+https://github.com/huggingface/diffusers.git
|
| 7 |
+
#transformers
|
| 8 |
+
git+https://github.com/huggingface/transformers
|
| 9 |
+
scipy
|
| 10 |
+
ftfy
|
| 11 |
+
psutil
|
| 12 |
+
accelerate==0.16.0
|
| 13 |
+
OmegaConf
|
| 14 |
+
pytorch_lightning
|
| 15 |
+
triton==2.0.0.dev20230208
|
| 16 |
+
#https://github.com/apolinario/xformers/releases/download/0.0.3/xformers-0.0.14.dev0-cp38-cp38-linux_x86_64.whl
|
| 17 |
+
https://github.com/ZyCromerZ/xformers_builds/releases/download/xformers-2023-02-12-Py-3.8-Cuda-11.8.0-PyTorch-1.13.1%2Bcu117-ubuntu-18.04/xformers-0.0.17+12c076d.d20230212-cp38-cp38-linux_x86_64.whl
|
style.css
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.finetuned-diffusion-div div{
|
| 2 |
+
display:inline-flex;
|
| 3 |
+
align-items:center;
|
| 4 |
+
gap:.8rem;
|
| 5 |
+
font-size:1.75rem
|
| 6 |
+
}
|
| 7 |
+
.finetuned-diffusion-div div h1{
|
| 8 |
+
font-weight:900;
|
| 9 |
+
margin-bottom:7px
|
| 10 |
+
}
|
| 11 |
+
.finetuned-diffusion-div p{
|
| 12 |
+
margin-bottom:10px;
|
| 13 |
+
font-size:94%
|
| 14 |
+
}
|
| 15 |
+
a{
|
| 16 |
+
text-decoration:underline
|
| 17 |
+
}
|
| 18 |
+
.tabs{
|
| 19 |
+
margin-top:0;
|
| 20 |
+
margin-bottom:0
|
| 21 |
+
}
|
| 22 |
+
#gallery{
|
| 23 |
+
min-height:20rem
|
| 24 |
+
}
|
utils.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def is_google_colab():
|
| 2 |
+
try:
|
| 3 |
+
import google.colab
|
| 4 |
+
return True
|
| 5 |
+
except:
|
| 6 |
+
return False
|