undo chages

Former-commit-id: a136562113905f3529761db78f136c8eecd2a1ed [formerly 0b7dbb9bec]
Former-commit-id: 1807289d16e19f805940762ac7063be9170a82aa
This commit is contained in:
frostydad 2022-09-22 21:14:19 -06:00
parent 1ae81c1ee3
commit 5001537316
3 changed files with 17 additions and 123 deletions

View File

@ -1,31 +0,0 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: BSFishy/pip-action@v1
with:
packages: |
requests
huggingface_hub
pillow
- uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
- name: Generate Static Webpage
run: python ${{ github.workspace }}/other/generate_tx_models_html.py
shell: sh

View File

@ -1,84 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Stable Diffusion Texual Inversion Models</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
</head>
<body>
<style>
.img-wrapper {
display: flex;
margin-top: 40px;
}
.img1,
.img2,
.img3 {}
.thumbnail {
height: 185px;
}
.model-link {}
.model-title {
margin-top: 100px;
}
.model-link-wrapper {}
</style>
<div class="container" style="margin-bottom: 180px;">
<div class="jumbotron text-center" style="margin: 45px;"><h1>Stable Diffusion Texual Inversion Models</h1></div>
<p>
Generated from <a href="https://huggingface.co/sd-concepts-library">huggingface.co/sd-concepts-library</a>
</p>
<p>
Downloaded models are straight from the HuggingFace repositories and are named learned_embeds.bin. Rename to model_name.pt
</p>
<br><hr>
<h3 class="model-title">jetsetdreamcastcovers</h3>
<p><a class="model-link" href="https://huggingface.co/sd-concepts-library/jetsetdreamcastcovers/resolve/main/learned_embeds.bin">Download jetsetdreamcastcovers</a></p>
<p><a class="model-link" href="https://huggingface.co/sd-concepts-library/jetsetdreamcastcovers/">View Repository</a></p>
<div class="img-wrapper">
<div class="img1" style="width:2560px;">
<img class="thumbnail" src="https://huggingface.co/sd-concepts-library/jetsetdreamcastcovers/resolve/main/concept_images/0.jpeg">
</div>
<div class="img2" style="width:2560px;">
<img class="thumbnail" src="https://huggingface.co/sd-concepts-library/jetsetdreamcastcovers/resolve/main/concept_images/1.jpeg">
</div>
<div class="img3" style="width:2560px;">
<img class="thumbnail" src="https://huggingface.co/sd-concepts-library/jetsetdreamcastcovers/resolve/main/concept_images/2.jpeg">
</div>
</div><h3 class="model-title">yoji-shinkawa-style</h3>
<p><a class="model-link" href="https://huggingface.co/sd-concepts-library/yoji-shinkawa-style/resolve/main/learned_embeds.bin">Download yoji-shinkawa-style</a></p>
<p><a class="model-link" href="https://huggingface.co/sd-concepts-library/yoji-shinkawa-style/">View Repository</a></p>
<div class="img-wrapper">
<div class="img1" style="width:1014px;">
<img class="thumbnail" src="https://huggingface.co/sd-concepts-library/yoji-shinkawa-style/resolve/main/concept_images/0.jpeg">
</div>
<div class="img2" style="width:1014px;">
<img class="thumbnail" src="https://huggingface.co/sd-concepts-library/yoji-shinkawa-style/resolve/main/concept_images/1.jpeg">
</div>
<div class="img3" style="width:1014px;">
<img class="thumbnail" src="https://huggingface.co/sd-concepts-library/yoji-shinkawa-style/resolve/main/concept_images/2.jpeg">
</div>
</div><h3 class="model-title">million-live-akane-3k</h3>
<p><a class="model-link" href="https://huggingface.co/sd-concepts-library/million-live-akane-3k/resolve/main/learned_embeds.bin">Download million-live-akane-3k</a></p>
<p><a class="model-link" href="https://huggingface.co/sd-concepts-library/million-live-akane-3k/">View Repository</a></p>
<div class="img-wrapper">
<div class="img1" style="width:1282px;">
<img class="thumbnail" src="https://huggingface.co/sd-concepts-library/million-live-akane-3k/resolve/main/concept_images/0.png">
</div>
<div class="img2" style="width:1282px;">
<img class="thumbnail" src="https://huggingface.co/sd-concepts-library/million-live-akane-3k/resolve/main/concept_images/1.png">
</div>
<div class="img3" style="width:1282px;">
<img class="thumbnail" src="https://huggingface.co/sd-concepts-library/million-live-akane-3k/resolve/main/concept_images/2.png">
</div>
</div></div></body></html>

View File

@ -1,5 +1,8 @@
import argparse
import datetime
import os
import shutil
import sys
from urllib import request as ulreq
import requests
@ -26,13 +29,20 @@ def getsizes(uri):
file.close()
return (size, None)
parser = argparse.ArgumentParser()
parser.add_argument('out_file', nargs='?', help='file to save to')
args = parser.parse_args()
print('Will save to file:', args.out_file)
# Get list of models under the sd-concepts-library organization
print('Getting list of models...')
api = HfApi()
models_list = []
for model in api.list_models(author="sd-concepts-library"):
models_list.append(model.modelId.replace('sd-concepts-library/', ''))
models_list.sort()
print(models_list)
html_struct = """<!DOCTYPE html>
<html lang="en">
@ -67,6 +77,7 @@ html_struct = """<!DOCTYPE html>
</style>
<div class="container" style="margin-bottom: 180px;">
<div class="jumbotron text-center" style="margin: 45px;"><h1>Stable Diffusion Texual Inversion Models</h1></div>
<p><i>Page updates daily. Last updated {datetime.datetime.now().strftime("%A, %B %d %Y")}.</i></p>
<p>
Generated from <a href="https://huggingface.co/sd-concepts-library">huggingface.co/sd-concepts-library</a>
@ -80,9 +91,12 @@ html_struct = """<!DOCTYPE html>
<br><hr>
"""
# Move the model out
i = 1
for model_name in models_list:
if i == 3:
break
print(f'{i}/{len(models_list)} -> {model_name}')
# if os.path.exists(f'{model_name}/learned_embeds.bin'): # double check the file exists since sometimes it hasn't been uploaded yet
# shutil.move(f'{model_name}/learned_embeds.bin', f'{model_name}/{model_name}.pt')
@ -118,11 +132,6 @@ for model_name in models_list:
html_struct = html_struct + '</div></body></html>'
f = open('sd-concepts-library.html', 'w')
f = open(args.out_file, 'w')
f.write(html_struct)
f.close()
# markdown = markdownify.markdownify(html_struct, heading_style="ATX")
# f = open('sd-concepts-library.md', 'w')
# f.write(markdown)
# f.close()