Update app.py
Browse files
app.py
CHANGED
@@ -36,26 +36,6 @@ from huggingface_hub import hf_hub_download
|
|
36 |
#@markdown Enter the `repo_id` for a concept you like (you can find pre-learned concepts in the public [SD Concepts Library](https://huggingface.co/sd-concepts-library))
|
37 |
repo_id_embeds = "sd-concepts-library/mikako-methodi2i" #@param {type:"string"}
|
38 |
|
39 |
-
|
40 |
-
#@markdown (Optional) in case you have a `learned_embeds.bin` file and not a `repo_id`, add the path to `learned_embeds.bin` to the `embeds_url` variable
|
41 |
-
embeds_url = "" #Add the URL or path to a learned_embeds.bin file in case you have one
|
42 |
-
placeholder_token_string = "" #Add what is the token string in case you are uploading your own embed
|
43 |
-
|
44 |
-
downloaded_embedding_folder = "./downloaded_embedding"
|
45 |
-
if not os.path.exists(downloaded_embedding_folder):
|
46 |
-
os.mkdir(downloaded_embedding_folder)
|
47 |
-
if(not embeds_url):
|
48 |
-
embeds_path = hf_hub_download(repo_id=repo_id_embeds, filename="learned_embeds.bin", use_auth_token=True)
|
49 |
-
token_path = hf_hub_download(repo_id=repo_id_embeds, filename="token_identifier.txt", use_auth_token=True)
|
50 |
-
with open(f'{downloaded_embedding_folder}/token_identifier.txt', 'r') as file:
|
51 |
-
placeholder_token_string = file.read()
|
52 |
-
else:
|
53 |
-
!wget -q -O $downloaded_embedding_folder/learned_embeds.bin $embeds_url
|
54 |
-
|
55 |
-
learned_embeds_path = f"{downloaded_embedding_folder}/learned_embeds.bin"
|
56 |
-
|
57 |
-
display (Markdown("## The placeholder token for your concept is `%s`"%(placeholder_token_string)))
|
58 |
-
|
59 |
def image_grid(imgs, rows, cols):
|
60 |
assert len(imgs) == rows*cols
|
61 |
|
|
|
36 |
#@markdown Enter the `repo_id` for a concept you like (you can find pre-learned concepts in the public [SD Concepts Library](https://huggingface.co/sd-concepts-library))
|
37 |
repo_id_embeds = "sd-concepts-library/mikako-methodi2i" #@param {type:"string"}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
def image_grid(imgs, rows, cols):
|
40 |
assert len(imgs) == rows*cols
|
41 |
|