theunkowndude / leonardoWrapper

MIT License
4 stars 1 forks source link

The project is so great #1

Closed KalvinThien closed 2 months ago

KalvinThien commented 2 months ago

The project is so great, can you add a way to get the Seed ID? I want when creating the first image, the subsequent images will use the seed id to maintain the consistency of the image afterwards. Is this possible? Thank you

theunkowndude commented 2 months ago

Hi, do you mean the Seed ID from a generated image?

KalvinThien commented 2 months ago

Hi, do you mean the Seed ID from a generated image?

That's right, using the Seed ID will help create a photo that is then designed in the same way, just changing the prompt to change the scene. It will help a lot in creating photos, and turning photos into videos. Because I think it will come in handy when creating videos in bulk.

I've also designed a small piece of code to create a bunch of Leonardo accounts for free (150 creadits/day). It will help a lot when copying the seed ID and transferring it and the photos that I need. To maintain consistency.

theunkowndude commented 2 months ago

I will implement it in the next update.

anditv21 commented 2 months ago

I will implement it in the next update.

Nice 👌

KalvinThien commented 2 months ago

I will implement it in the next update.

Thanks for that

KalvinThien commented 2 months ago

Also, I noticed that you are using a random 1 number mechanic user_agent available randomly, it is only suitable for a small number of users. You can use this module to create different user agents, which will be convenient and the code is more compact :

https://pypi.org/project/user-agent/

KalvinThien commented 2 months ago

this is the part I use to create videos from photos, I hope it will help you integrate into leonardoWrapper to be able to call to create videos from photos :


def generate_and_download_video(
    leonardo_page, prompt, file_suffix, image_locator, save_dir
):
    leonardo_page.page.get_by_placeholder("Type a prompt ...").click()
    leonardo_page.page.get_by_placeholder("Type a prompt ...").fill(prompt)
    leonardo_page.page.get_by_role("button", name="Generate 2").click()
    image = leonardo_page.page.locator(image_locator)
    image.wait_for(state="visible", timeout=20000)
    image.hover()
    image.get_by_label("Generate Motion video").click()
    leonardo_page.page.locator(
        "footer > div > button.chakra-button.css-17emeou"
    ).click()
    video = leonardo_page.page.locator(
        "div.css-1uhvlas > div:nth-child(2) > div.css-hoyejk > div > div:nth-child(3) > div > div:nth-child(2) > div:nth-child(1) > div > div > div:nth-child(2)"
    )
    video.wait_for(state="visible", timeout=600000)
    video.hover()
    leonardo_page.page.locator(
        "div.css-1uhvlas > div:nth-child(2) > div.css-hoyejk > div > div:nth-child(3) > div > div:nth-child(2) > div:nth-child(1)"
    ).hover()
    Path(SAVE_PATH + save_dir + "/").mkdir(parents=True, exist_ok=True)

    with leonardo_page.page.expect_download() as download_info:
        leonardo_page.page.locator(
            "div.css-1uhvlas > div:nth-child(2) > div.css-hoyejk > div > div:nth-child(3) > div > div:nth-child(2) > div:nth-child(1) > div > div > div.css-1lpsa6b > div.css-1sg7dwz> div > button"
        ).click()

    download = download_info.value
    download.save_as(os.path.join(save_dir, file_suffix))``` 
anditv21 commented 2 months ago

We are working request based and everything is working

anditv21 commented 2 months ago

And we will add video generation soon

KalvinThien commented 2 months ago

thanks for that