CiaraStrawberry / TemporalKit

An all in one solution for adding Temporal Stability to a Stable Diffusion Render via an automatic1111 extension
GNU General Public License v3.0
1.91k stars 124 forks source link

path problem on runpod jupyter lab #51

Open kasparovabi opened 1 year ago

kasparovabi commented 1 year ago

Görüntü 27 05 2023 21 50 i made first steps and stylized the input files in img2img than bring it back to ebsynth-process put the path like "/workspace/temporalkitfiles/dans", at first 2 videos i got no problem but than problems started, i did solve the problem by moving the folder to another path or something else but those are unrelative solutions, but today, nothing works, i use runpod.io, and just spending my credits to solve this problem :(

kasparovabi commented 1 year ago

gpt3 says;

Thank you for providing the code snippet. Based on the provided function, it seems that the code is designed to crossfade between images in a folder of folders. The function takes the output folder path as an argument and then attempts to iterate over the subdirectories within that folder.

The error you encountered is likely due to the presence of a directory called ".ipynb_checkpoints" within one of the subdirectories. This directory is created by Jupyter Notebook/ JupyterLab and is not a valid image file. When the code encounters this directory, it tries to open it as an image file, resulting in the "IsADirectoryError" you encountered.

To handle this issue, you can modify the code to skip any directories that are not valid image files. Here's an updated version of the function that includes this error handling:

python Copy code import os from PIL import Image

def crossfade_folder_of_folders(output_folder, fps, return_generated_video_path=False): """Crossfade between images in a folder of folders and save the results.""" root_folder = output_folder all_dirs = [d for d in os.listdir(root_folder) if os.path.isdir(os.path.join(root_folder, d))] dirs = [d for d in alldirs if d.startswith("out")]

for dir_name in dirs:
    images_folder = os.path.join(root_folder, dir_name)
    image_files = [f for f in os.listdir(images_folder) if os.path.isfile(os.path.join(images_folder, f))]
    image_files = [f for f in image_files if f.lower().endswith(('.png', '.jpg', '.jpeg', '.gif'))]

    for i in range(len(image_files) - 1):
        image1_path = os.path.join(images_folder, image_files[i])
        image2_path = os.path.join(images_folder, image_files[i + 1])

        try:
            image1 = Image.open(image1_path)
            image2 = Image.open(image2_path)

            # Rest of your crossfade logic goes here

        except IOError:
            # Handle invalid image file error
            print(f"Skipping invalid image file: {image1_path} or {image2_path}")

Example usage

crossfade_folder_of_folders("/path/to/output_folder", 30)

but because of gpt3, i couldnt trust the code dont know what else to do

tomasimf commented 1 year ago

Hi, I did the following:

Remove: .ipynb_checkpoints

It's hidden. You just have to go to the folder where it says it is, open TERMINAL and put:

ls -a

to check that it exists, and then:

rm *

If the images are deleted, you upload them back to the folder.

But the IsADirectoryError problem is gone forever. I hope it works for you, I don't have much knowledge in jupyter, linux and etc.

kasparovabi commented 1 year ago
Ekran Resmi 2023-05-31 11 13 08

thx for your help, but it does'nt remove that file, removes the photos but not the .ipynb_checkpoints file :(

kasparovabi commented 1 year ago

i used this one "rmdir /workspace/temporalkit/dans/0/out_00001/.ipynb_checkpoints" and it worked, thank you so much for the inspiration <3

tomasimf commented 1 year ago

Great! I was wrong, it was as follows:

.ipynb_checkpoints

It's hidden. You just have to go to the folder where it says it is, open TERMINAL and put:

ls -a

and then:

rm -r .ipynb_checkpoints

finally all good

HerOIraK commented 1 year ago

I have the same problem but I can not find this file .ipynb_checkpoints