Skip to content

Commit

Permalink
Bugfixes for docker users with multiple hard drives (Issue #57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Woolverine94 committed Nov 8, 2024
1 parent b34665c commit 1e6f37b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
5 changes: 3 additions & 2 deletions ressources/animatediff_lcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from huggingface_hub import snapshot_download, hf_hub_download
from safetensors.torch import load_file
import tomesd
import shutil

device_label_animatediff_lcm, model_arch = detect_device()
device_animatediff_lcm = torch.device(device_label_animatediff_lcm)
Expand Down Expand Up @@ -221,12 +222,12 @@ def video_animatediff_lcm(
savename = ".tmp/tmp_animatelcm_out.mp4"
savename_final = name_seeded_video(seed_id)
export_to_video(result, savename, fps=num_fps_animatediff_lcm)
os.rename(savename, savename_final)
shutil.move(savename, savename_final)
elif output_type_animatediff_lcm == "gif" :
savename = ".tmp/tmp_animatelcm_out.gif"
savename_rename = name_seeded_gif(seed_id)
export_to_gif(result, savename, fps=num_fps_animatediff_lcm)
os.rename(savename, savename_rename)
shutil.move(savename, savename_rename)
savename_final.append(savename_rename)
final_seed.append(seed_id)

Expand Down
5 changes: 3 additions & 2 deletions ressources/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import exiv2
import ffmpeg
import music_tag
import shutil

device_torch = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

Expand Down Expand Up @@ -679,7 +680,7 @@ def metadata_writer_gif(metadata, filename, fps):
if check_metadata("biniou_global_gif_exif") == True:
frametime = int((1000/fps))
for j in range(len(filename)):
os.rename(filename[j], ".tmp/tmp.gif")
shutil.move(filename[j], ".tmp/tmp.gif")
with Image.open(".tmp/tmp.gif") as image:
image.save(filename[j], save_all=True, duration=frametime, comment=f"biniou settings: {metadata}")
os.remove(".tmp/tmp.gif")
Expand All @@ -693,7 +694,7 @@ def metadata_writer_mp4(metadata, filename):
else:
filename_list = filename
for j in range(len(filename_list)):
os.rename(filename_list[j], ".tmp/tmp.mp4")
shutil.move(filename_list[j], ".tmp/tmp.mp4")
ffmpeg.input(".tmp/tmp.mp4").output(filename_list[j], metadata=f"comment=biniou settings: {metadata}", map=0, c="copy").overwrite_output().run()
os.remove(".tmp/tmp.mp4")
return
Expand Down
5 changes: 0 additions & 5 deletions ressources/img2vid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
device_label_img2vid, model_arch = detect_device()
device_img2vid = torch.device(device_label_img2vid)

# Block to remove :
if os.path.exists("./models/Stable_Diffusion_Video/") :
os.rename("./models/Stable_Diffusion_Video/", "./models/Stable_Video_Diffusion/")
# End of block

model_path_img2vid = "./models/Stable_Video_Diffusion/"
model_path_safetychecker_img2vid = "./models/Stable_Diffusion/"
os.makedirs(model_path_img2vid, exist_ok=True)
Expand Down
8 changes: 5 additions & 3 deletions webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import os
import gradio as gr
import numpy as np
import shutil
# import shutil
from PIL import Image
from ressources import *
import sys
Expand All @@ -28,8 +28,10 @@ def local_ip():
return host_ip

tmp_biniou="./.tmp"
if os.path.exists(tmp_biniou) :
shutil.rmtree(tmp_biniou)
if os.path.exists(tmp_biniou):
# shutil.rmtree(tmp_biniou)
for tmpfile in os.listdir(tmp_biniou):
os.remove(os.path.join(tmp_biniou, tmpfile))
os.makedirs(tmp_biniou, exist_ok=True)

blankfile_common = "./.tmp/blank.txt"
Expand Down

0 comments on commit 1e6f37b

Please sign in to comment.