Skip to content

Commit

Permalink
Merge pull request #14 from etherealxx/sdless
Browse files Browse the repository at this point in the history
🎁🥳Release v3.0.0

- Added `@extract` syntax
- Supports for custom hashtags with `@new` syntax
- (Almost) Full Windows support
- Auto-download config file if available when downloading from CivitAI (SD 2.0+)
- Auto-renaming for downloading ckpt/safetensors and pruned model from CivitAI using direct link method
- CivitAI direct link now use `curl` to get the filename, and use the chosen download method (from the four) to download. Huge download speed boost. `requests` is no longer needed.
- Supports download from Anonfiles, Dropbox, Google Drive, Mediafire, Pixeldrain
- Supports download from Github (raw and release files)
- Supports for SDless mode (read more [here](https://github.com/etherealxx/batchlinks-webui#sdless-mode))
- UI overhaul:
- Now there's a table that shows where does the hashtags points into
- Option to stretch the UI, if your monitor is small, or using colab on mobile
- Option to hide help text
- Option to choose preferred CivitAI models. This will works if you download the model via model page link (https://civitai.com/models/)
- Upload txt now use a little button instead of covering half of the screen

Fixes:
- CivitAI `model page link` no longer randomly download the first model on the json list.
- Most of Windows bugs
- Renaming problem when using CivitAI model page link method
- Warning message when CivitAI download isn't possible (server down)
  • Loading branch information
etherealxx authored Mar 19, 2023
2 parents 6f8c65f + 54c2c5d commit 0acffad
Show file tree
Hide file tree
Showing 23 changed files with 1,339 additions and 288 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
*.bak
*.backup
imageratio.*
*.lnk
tempCodeRunnerFile.python
.DS_Store
gradiovenv/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -161,4 +165,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
#.idea/
312 changes: 261 additions & 51 deletions README.md

Large diffs are not rendered by default.

64 changes: 60 additions & 4 deletions howtogetthedirectlinks.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# How to get the direct links

Jump to: [Huggingface](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#huggingface) - [Civit AI](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#civit-ai) - [MEGA](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#mega) - [Discord](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#discord-attachments) - [Github (Extension)](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#webui-extension-github-repo-link) - [Github (Raw File)](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#raw-file-from-github) - [Github (Release File)](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#release-file-from-github) - [Google Drive](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#google-drive) - [Pixeldrain](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#pixeldrain) - - [Mediafire](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#mediafire) - [Anonfiles](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#anonfiles) - [Dropbox](https://github.com/etherealxx/batchlinks-webui/blob/main/howtogetthedirectlinks.md#dropbox)

## Huggingface

Locate the model page, click on `files` tab.<br/><br/>
Expand All @@ -9,9 +11,9 @@ choose the model you want, **right click** the arrow button beside the LFS logo,

## Civit AI

There are two ways to download links from Civit. The model link method, and the direct link method. The model link method **will automatically** choose the directory of the saved model without even using hashtag. You still need to define the output directory when using the direct link method.
There are two ways to download links from Civit. The model page link method, and the direct link method. The model page link method **will automatically** choose the directory of the saved model without even using hashtag, **except** if you want to put Lora into `#addnetlora` directory, you can use that hashtag. You still need to define the output directory when using the direct link method.

### Model Link Method
### Model Page Link Method

Locate the desired model on the main page of Civitai, **right click** the model thumbnail, then click `copy link address`.<br/><br/>
<img src="images/civitnew1.jpg" alt="cv" height="600" width="737"><br/><br/>
Expand All @@ -26,7 +28,7 @@ Locate the model page, **right click** the huge blue button, then click `copy li
With this method, you can also choose model variation, by clicking the dropdown icon on the blue button, then **right click** the desired model an.<br/><br/>
<img src="images/civit2.jpg" alt="cv" height="600" width="842"> <br/><br/>

## Mega
## MEGA

Locate the model you wanted, **right click** the item, click `copy link address`.<br/><br/>
<img src="images/mega1.jpg" alt="mg1" height="600" width="987"><br/><br/>
Expand All @@ -40,9 +42,63 @@ Locate the file you wanted, **right click** the download icon, then click `get l
Then click `copy link`.<br/><br/>
<img src="images/discord2.jpg" alt="mg2" height="600" width="963"><br/><br/>

## webui Extension
## webui Extension (Github repo link)

Locate the extension's repository, then copy the repository link.<br/><br/>
<img src="images/github.jpg" alt="mg1" height="600" width="831"><br/><br/>

Extension **will automatically** cloned/downloaded on `extensions` directory of webui without the need of hashtag.

## Raw file from Github

Locate the file's repository, then click the desired file.<br/><br/>
<img src="images/githubdirect1.png" alt="mg1" width="831"><br/><br/>
Then **right click** the text that says `raw` **or** `download`, and click `copy link address`<br/><br/>
<img src="images/githubdirect2.png" alt="mg1" width="831"><br/><br/>
<img src="images/githubdirect3.png" alt="mg1" width="831"><br/><br/>

## Release file from Github

Locate the file's repository, then click release section.<br/><br/>
<img src="images/githubrelease1.png" alt="mg1" width="831"><br/><br/>
Then **right click** the desired assets (the blue text), and click `copy link address`<br/><br/>
<img src="images/githubrelease2.png" alt="mg1" width="831"><br/><br/>

## Google Drive

Whether you own the file or not, make sure the file is public. If you owns the file, right click on the file on Google Drive, then click `get link` (or `share`).<br/><br/>
<img src="images/drive1.png" alt="mg1" width="400"><br/><br/>
Then change the access to `anyone with thelink`, and copy the link by clicking the button<br/><br/>
<img src="images/drive2.png" alt="mg1" width="831"><br/><br/>

These are some valid google drive link patterns that works:
```
https://drive.google.com/file/d/1-UbwFtSzKTQkvjdPiKLCejH0Ztq9UJFO/view
https://drive.google.com/file/d/1-UbwFtSzKTQkvjdPiKLCejH0Ztq9UJFO/view?usp=share_link
https://drive.google.com/u/0/uc?id=1-UbwFtSzKTQkvjdPiKLCejH0Ztq9UJFO&export=download
https://drive.google.com/u/0/uc?id=1-UbwFtSzKTQkvjdPiKLCejH0Ztq9UJFO&export=download&confirm=t
```
## Pixeldrain

Just click the `copy link` button, or just copy the link.<br/><br/>
<img src="images/pixeldrain.png" alt="mg1" width="800"><br/><br/>

## Anonfiles

**Don't** right click the download button. Instead, copy the link on the url bar<br/><br/>
<img src="images/anonfiles.png" alt="mg1" width="800"><br/><br/>

## Mediafire

When you arrived on this page, click the chain link icon to copy link, or just copy the link above<br/><br/>
<img src="images/mediafire.png" alt="mg1" width="800"><br/><br/>

Don't forget that when being pasted, the link must starts with `https://www.mediafire.com/file/` (notice the triple W)

## Dropbox

When the item is yours, go to the homepage, and click copy link, the link will be copied to your clipboard<br/><br/>
<img src="images/dropbox1.png" alt="mg1" width="600"><br/><br/>

Or, if you got into this screen, just copy the link above, with the link ends with either `?dl=0` or `?dl=1`<br/><br/>
<img src="images/dropbox2.png" alt="mg1" width="500"><br/><br/>
Binary file added images/anonfiles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/drive1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/drive2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/dropbox1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/dropbox2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/githubdirect1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/githubdirect2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/githubdirect3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/githubrelease1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/githubrelease2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mediafire.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/pixeldrain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sdless.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions misc/markydynamictohtml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#tableofcontentmaker
intro = """
<details>
<summary>Table of Contents</summary>
<ol>
"""

outro = """
</li>
</ol>
</details>
"""

tableofcontents = """
- [Installation](#installation)
- [About](#about)
- [Example](#example)
- [Syntax](#syntax)
- [Valid Hashtags](#valid-hashtags)
- [How to get the direct links (Important!)](#how-to-get-the-direct-links-important)
- [Huggingface's download method](#huggingfaces-download-method)
- [Civitai's download method](#civitais-download-method)
- [Rename Downloaded Files](#rename-downloaded-files)
- [Running Shell Commands](#running-shell-commands)
- [Gradio Queue](#gradio-queue)
- [Logging](#logging)
- [Cancel](#cancel)
- [Progress Bar](#progress-bar)
- [Changes if `--gradio-queue` is off](#changes-if---gradio-queue-is-off)
- [Other Features](#other-features)
- [Notification](#notification)
- [SDless mode](#sdless-mode)
- [Local Installation Support](#local-installation-support)
- [Latest release: v2.2.0](#latest-release-v220)
- [Release v2.2.0](#release-v220)
- [Release v2.1.1](#release-v211)
- [Release v2.1.0](#release-v210)
- [Roadmap](#roadmap)
- [Known Bugs](#known-bugs)
- [Contributing](#contributing)
- [Contact](#contact)
- [Acknowledgments](#acknowledgments)
"""

def mlineprint(toprint):
if toprint[-1] == '\n':
toprint = toprint[:-1]
print(toprint.replace('\n', '', 1))


def writehtmllist(space, namehead, hashtaghead):
spaces = ""
for _ in range(space):
spaces += " "
if initialspace >= 2:
return spaces + f'<ul><li><a href="{hashtaghead}">{namehead}</a></li></ul>'
else:
return spaces + f'<li><a href="{hashtaghead}">{namehead}</a></li>'

if __name__ == "__main__":
rows = tableofcontents.replace('\n', '', 1).splitlines()#split('\n') # split into a list of rows
mlineprint(intro)
for row in rows:
if not row == '':
initialspace = 0
for char in row:
if char == ' ':
initialspace += 1
else:
break
extractedrow = row.split("[")
cuttedrow = extractedrow[1].partition("](")
headingname = cuttedrow[0]
headinghashtag = cuttedrow[2].rstrip(")")
print(writehtmllist(initialspace+4, headingname, headinghashtag))
# print(cuttedrow[0])
# print(cuttedrow[2].rstrip(")"))
# hashtagrow = row.partit
mlineprint(outro)
4 changes: 2 additions & 2 deletions scripts/a_gradiocheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#os.system(f"sed -i 's/def run(command, choosedowner):/def run(command, choosedowner, progress=gr.Progress()):/g' {batchlinks_dir}")
# os.system(f"sed -i '/^#progress/s/^#//' {batchlinks_dir}")
new_contents = re.sub(r'^(\s*)#progress\(', r'\1progress(', contents, flags=re.MULTILINE)
contents = re.sub(r'choosedowner\):', 'choosedowner, progress=gr.Progress()):', new_contents, flags=re.MULTILINE)
contents = re.sub(r'civitvae\):', 'civitvae, progress=gr.Progress()):', new_contents, flags=re.MULTILINE)

with open(batchlinks_dir, 'w', encoding='utf-8') as f:
f.write(contents)
Expand All @@ -21,7 +21,7 @@
# os.system(f"sed -i 's/def run(command, choosedowner, progress=gr.Progress()):/def run(command, choosedowner):/g' {batchlinks_dir}")
# os.system(f"sed -i '/^progress(/ s/^/#/' {batchlinks_dir}")
new_contents = re.sub(r'^(\s*)progress\(', r'\1#progress(', contents, flags=re.MULTILINE)
contents = re.sub(r'choosedowner,\s*progress=gr\.Progress\(\)\):$', 'choosedowner):', new_contents, flags=re.MULTILINE)
contents = re.sub(r'civitvae,\s*progress=gr\.Progress\(\)\):$', 'civitvae):', new_contents, flags=re.MULTILINE)

with open(batchlinks_dir, 'w', encoding='utf-8') as f:
f.write(contents)
Loading

0 comments on commit 0acffad

Please sign in to comment.