Code Monkey home page Code Monkey logo

Comments (3)

JarvisSan22 avatar JarvisSan22 commented on August 23, 2024 1

Found this issue today.
There seem there two options. One resize the image before putting it replicate . Two create an alternative version of the repo and fix all the issues as the dev dont seem to be developing it anymore ( ノД`)シクシク…

from cog-sdxl.

JarvisSan22 avatar JarvisSan22 commented on August 23, 2024

My Current quck fix to this issue for a discord bot using replicate, is to use backblaze api to hold a resized image then use that for the imgurl.
May help out

def BB_imageFix(self,img_url,width,height):
        #Download discord image and resize 
        r=requests.get(img_url)
        image = Image.open(io.BytesIO(r.content))
        image=image.resize((width,height))
        file_name=f"placeholder_{os.path.basename(img_url)}"
        image.save(file_name)
        #Upload to backblaze 
        local_file = Path(file_name).resolve()
        metadata = {"key": "value"}
        uploaded_file = self.BB_bucket.upload_local_file(
                local_file=local_file,
                file_name=file_name,
                file_infos=metadata,
        )
        img_url=self.b2_api.get_download_url_for_fileid(uploaded_file.id_)
        os.remove(file_name) #Delete placeholder file from local 
        return img_url   

from cog-sdxl.

JarvisSan22 avatar JarvisSan22 commented on August 23, 2024

https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py
Going through the StableDiffusionXLImg2ImgPipeline that replicate uses there no width or height setting as these values seem to be based of the input image size but there is a target_size what could solve this issue

from cog-sdxl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.