diff --git a/.github/workflows/generate-webpage.yml b/.github/workflows/generate-webpage.yml new file mode 100644 index 0000000..8996a4b --- /dev/null +++ b/.github/workflows/generate-webpage.yml @@ -0,0 +1,153 @@ +# 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: actions/checkout@v3 + - name: Run Python Script + uses: jannekem/run-python-script-action@v1.3 + with: + script: | + import os + import shutil + from urllib import request as ulreq + + # import markdownify + import requests + from PIL import ImageFile + + + def getsizes(uri): + # https://stackoverflow.com/a/37709319 + # get file size *and* image size (None if not known) + file = ulreq.urlopen(uri) + size = file.headers.get("content-length") + if size: + size = int(size) + p = ImageFile.Parser() + while True: + data = file.read(1024) + if not data: + break + p.feed(data) + if p.image: + return size, p.image.size + break + file.close() + return (size, None) + + + # Get list of model directories + working_dir = os.getcwd() + root_dir_list = [] + for x in os.listdir(working_dir): + if os.path.isdir(x): + root_dir_list.append(x) + + html_struct = f""" + +
++ Generated from huggingface.co/sd-concepts-library +
+ ++ Downloaded models are straight from the HuggingFace repositories and are named learned_embeds.bin. Rename to model_name.pt +
+ ++ The HuggingFace repository is changed regularly so this page might not be current. +
+ + +