mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
Fix cache_folder bug introduced in 37eff915d6
This commit is contained in:
parent
37eff915d6
commit
e4d724eb3f
@ -567,10 +567,10 @@ def generate_pfp_cache(character):
|
||||
for path in [Path(f"characters/{character}.{extension}") for extension in ['png', 'jpg', 'jpeg']]:
|
||||
if path.exists():
|
||||
original_img = Image.open(path)
|
||||
original_img.save(Path('{cache_folder}/pfp_character.png'), format='PNG')
|
||||
original_img.save(Path(f'{cache_folder}/pfp_character.png'), format='PNG')
|
||||
|
||||
thumb = make_thumbnail(original_img)
|
||||
thumb.save(Path('{cache_folder}/pfp_character_thumb.png'), format='PNG')
|
||||
thumb.save(Path(f'{cache_folder}/pfp_character_thumb.png'), format='PNG')
|
||||
|
||||
return thumb
|
||||
|
||||
@ -596,7 +596,7 @@ def load_character(character, name1, name2):
|
||||
data = json.loads(file_contents) if extension == "json" else yaml.safe_load(file_contents)
|
||||
cache_folder = Path(shared.args.disk_cache_dir)
|
||||
|
||||
for path in [Path("{cache_folder}/pfp_character.png"), Path("{cache_folder}/pfp_character_thumb.png")]:
|
||||
for path in [Path(f"{cache_folder}/pfp_character.png"), Path(f"{cache_folder}/pfp_character_thumb.png")]:
|
||||
if path.exists():
|
||||
path.unlink()
|
||||
|
||||
@ -719,12 +719,12 @@ def upload_your_profile_picture(img):
|
||||
cache_folder.mkdir()
|
||||
|
||||
if img is None:
|
||||
if Path("{cache_folder}/pfp_me.png").exists():
|
||||
Path("{cache_folder}/pfp_me.png").unlink()
|
||||
if Path(f"{cache_folder}/pfp_me.png").exists():
|
||||
Path(f"{cache_folder}/pfp_me.png").unlink()
|
||||
else:
|
||||
img = make_thumbnail(img)
|
||||
img.save(Path('{cache_folder}/pfp_me.png'))
|
||||
logger.info('Profile picture saved to "{cache_folder}/pfp_me.png"')
|
||||
img.save(Path(f'{cache_folder}/pfp_me.png'))
|
||||
logger.info(f'Profile picture saved to "{cache_folder}/pfp_me.png"')
|
||||
|
||||
|
||||
def generate_character_yaml(name, greeting, context):
|
||||
|
Loading…
Reference in New Issue
Block a user