CoolFace
Apppublic

huggingface-projects/diffusers-gallery

sourceHugging Facemitupdated 3y agoView on Hugging Face
489likes
index.html310 linesDownload Raw Back to root
1<!DOCTYPE html>2<html>3  <head>4    <meta charset="utf-8" />5    <meta name="viewport" content="width=device-width" />6 7    <title>Diffusers gallery</title>8    <meta9      name="description"10      content="Discover all difussion models on the Hugging Face hub."11    />12 13    <meta14      property="og:url"15      content="https://huggingface-projects-diffusers-gallery.hf.space/"16    />17    <meta property="og:type" content="website" />18    <meta19      property="og:title"20      content="Hugging Face - Diffusers Models Gallery"21    />22    <meta23      property="og:description"24      content="Discover all difussion models on the Hugging Face hub."25    />26    <meta27      property="og:image"28      content="https://huggingface-projects-diffusers-gallery.hf.space/Fo6vR6JX0AEjbw1.jpeg"29    />30 31    <meta name="twitter:card" content="player" />32    <meta33      property="twitter:url"34      content="https://huggingface-projects-diffusers-gallery.hf.space/"35    />36    <meta37      name="twitter:description"38      content="Discover all difussion models on the Hugging Face hub."39    />40 41    <meta name="twitter:site" content="@huggingface" />42    <meta43      name="twitter:title"44      content="Hugging Face - Diffusers Models Gallery"45    />46 47    <meta48      name="twitter:image"49      content="https://huggingface-projects-diffusers-gallery.hf.space/Fo6vR6JX0AEjbw1.jpeg"50    />51    <meta52      name="twitter:player"53      content="https://huggingface-projects-diffusers-gallery.hf.space/index.html"54    />55    <meta name="twitter:player:width" content="100%" />56    <meta name="twitter:player:height" content="600" />57 58    <script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script>59    <script src="https://cdn.tailwindcss.com"></script>60 61    <script type="module">62      import Alpine from "https://cdn.skypack.dev/alpinejs";63      import Intersect from "https://cdn.skypack.dev/@alpinejs/intersect";64      Alpine.plugin(Intersect);65 66      Alpine.data("modelsData", () => ({67        async init() {68          const data = await this.getModels(this.page, this.sort, this.filter);69          this.models = data.models;70          this.totalPages = data.totalPages;71        },72        ASSETS_URL: "https://d26smi9133w0oo.cloudfront.net/diffusers-gallery/",73        models: [],74        filter: "all",75        sort: "trending",76        page: 1,77        totalPages: -1,78        buttonClass(attr, filter) {79          if (this[attr] === filter) {80            return "bg-black dark:bg-white shadow-lg text-white dark:text-black hover:bg-black hover:text-white";81          }82          return "text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800";83        },84        async filterModels(style) {85          this.filter = style;86          this.page = 1;87          const data = await this.getModels(this.page, this.sort, this.filter);88          this.models = data.models;89          this.totalPages = data.totalPages;90        },91        async sortModels(sort) {92          this.sort = sort;93          this.page = 1;94          const data = await this.getModels(this.page, this.sort, this.filter);95          this.models = data.models;96          this.totalPages = data.totalPages;97        },98        async getModels(page, sort, style) {99          // const res = await fetch(100          //   `http://localhost:7860/api/models?page=${page}&sort=${sort}&style=${style}`101          // );102          const res = await fetch(103            `https://huggingface-projects-diffusers-gallery-bot.hf.space/api/models?page=${page}&sort=${sort}&style=${style}`104          );105          const data = await res.json();106          const models = data.models.map((model) => ({107            id: model.id,108            likes: model.likes,109            class: model.class,110            isNFSW: model.isNFSW,111            images: model.images.filter(112              (image) => image && image.endsWith(".jpg")113            ),114          }));115 116          return {117            models,118            totalPages: data.totalPages,119          };120        },121        async nextPage() {122          if (this.page < this.totalPages) {123            this.page += 1;124            const data = await this.getModels(125              this.page,126              this.sort,127              this.filter128            );129            this.models = this.models.concat(data.models);130            this.totalPages = data.totalPages;131          }132        },133      }));134      Alpine.start();135    </script>136  </head>137 138  <body class="pb-10 pt-5 bg-gray-100 dark:bg-gray-900 relative">139    <section class="container mx-auto w-full px-6 mb-8 mt-2">140      <div141        class="w-full px-8 py-8 lg:py-12 rounded-3xl bg-neutral-950 flex-col lg:flex-row items-start justify-between lg:items-center flex gap-5 ring-4 ring-neutral-500/20"142      >143        <div>144          <p class="text-2xl font-extrabold text-white drop-shadow">145            LoRA Studio is here!146          </p>147          <p class="text-base font-medium drop-shadow mt-1 lg:mt-3 text-white">148            Discover all the diffusion models on the LoRA Studio hub.149            <br />150            <span151              class="bg-gradient-to-r from-cyan-500 to-pink-500 italic text-sm bg-clip-text text-transparent"152            >153              Try, share and like your favorite models!154            </span>155          </p>156        </div>157        <a158          href="https://huggingface.co/spaces/enzostvs/lora-studio"159          target="_blank"160          class="bg-neutral-950 rounded-full px-6 py-3 inline-block relative overflow-hidden text-white font-bold z-[1] ring-[4px] ring-cyan-500/20 group"161        >162          <span163            class="absolute top-0 left-0 w-full h-full bg-cover z-[-1] opacity-70 group-hover:opacity-100 transition-all duration-200"164            style="background-image: url('./banner.webp')"165          ></span>166          Discover LoRA Studio167        </a>168      </div>169    </section>170    <section171      class="container px-6 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 mx-auto relative"172      x-data="modelsData"173    >174      <div class="col-span-2 lg:col-span-1 flex flex-col gap-2 row-start">175        <h1 class="text-lg font-semibold dark:text-white whitespace-nowrap">176          Diffusers Models Gallery177        </h1>178      </div>179 180      <div181        class="col-span-2 md:col-span-3 flex items-center gap-4 flex flex-wrap lg-auto lg:ml-auto text-sm"182      >183        <div class="flex gap-2">184          <span class="md:px-3 py-1 dark:text-white text-gray-400"185            >sort by</span186          >187          <button188            :class="buttonClass('sort', 'trending')"189            class="px-2 md:px-3 py-1 rounded-full text"190            @click="sortModels('trending')"191          >192            Trending193          </button>194          <button195            :class="buttonClass('sort', 'recent')"196            class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"197            @click="sortModels('recent')"198          >199            Recent200          </button>201          <button202            :class="buttonClass('sort', 'likes')"203            class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"204            @click="sortModels('likes')"205          >206            Most Likes207          </button>208        </div>209        <div class="flex gap-2">210          <span class="md:px-3 py-1 dark:text-white text-gray-400"> style</span>211          <button212            :class="buttonClass('filter', 'all')"213            class="px-2 md:px-3 py-1 rounded-full"214            @click="filterModels('all')"215          >216            All217          </button>218          <button219            :class="buttonClass('filter', 'anime')"220            class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"221            @click="filterModels('anime')"222          >223            Anime224          </button>225          <button226            :class="buttonClass('filter', '3d')"227            class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"228            @click="filterModels('3d')"229          >230            3D231          </button>232          <button233            :class="buttonClass('filter', 'realistic')"234            class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"235            @click="filterModels('realistic')"236          >237            Realistic238          </button>239          <button240            :class="buttonClass('filter', 'lora')"241            class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"242            @click="filterModels('lora')"243          >244            Lora245          </button>246        </div>247      </div>248 249      <template x-for="model in models" :key="model.id">250        <template x-if="model.images.length > 0">251          <a252            :href="`https://huggingface.co/${model.id}`"253            class="block bg-gray-900 rounded-xl overflow-hidden relative group aspect-square text-white"254            target="_blank"255          >256            <div257              class="absolute bottom-0 p-4 bg-gradient-to-t text-white pt-10 from-black/90 via-black/70 to-transparent w-full z-10"258            >259              <div260                class="text-sm flex items-center group-hover:translate-x-0.5 transition"261              >262                <svg263                  class="mr-1.5 text-white/70"264                  xmlns="http://www.w3.org/2000/svg"265                  xmlns:xlink="http://www.w3.org/1999/xlink"266                  aria-hidden="true"267                  focusable="false"268                  role="img"269                  width="1em"270                  height="1em"271                  preserveAspectRatio="xMidYMid meet"272                  viewBox="0 0 32 32"273                  fill="currentColor"274                >275                  <path276                    d="M22.5,4c-2,0-3.9,0.8-5.3,2.2L16,7.4l-1.1-1.1C12,3.3,7.2,3.3,4.3,6.2c0,0-0.1,0.1-0.1,0.1c-3,3-3,7.8,0,10.8L16,29l11.8-11.9c3-3,3-7.8,0-10.8C26.4,4.8,24.5,4,22.5,4z"277                  ></path>278                </svg>279                <span x-text="model.likes"></span>280              </div>281              <div282                x-text="model.id"283                class="text-sm md:text-lg lg:text-xl font-semibold group-hover:translate-x-0.5 transition"284              ></div>285            </div>286            <div287              class="group-hover:brightness-90 h-full"288              :class="model.isNFSW ? 'blur-md' : ''"289            >290              <template x-if="model.images[0]">291                <img292                  :src="()=> ASSETS_URL + model.images[0]"293                  :alt="model.id"294                  alt=""295                  class="w-full h-full object-cover group-hover:scale-[1.01] transition"296                />297              </template>298            </div>299          </a>300        </template>301      </template>302      <div303        class="h-12 relative"304        x-intersect="nextPage"305        data-iframe-height306      ></div>307    </section>308  </body>309</html>310