Skip to content

Use externally generated Depth map? #103

Answered by kiriri
bruibbruib asked this question in Q&A
Discussion options

You must be logged in to vote

Replace gradio_depth2image.py with the following code

from share import *
import config

import cv2
import einops
import gradio as gr
import numpy as np
import torch
import random

from pytorch_lightning import seed_everything
from annotator.util import resize_image, HWC3
from annotator.midas import MidasDetector
from cldm.model import create_model, load_state_dict
from ldm.models.diffusion.ddim import DDIMSampler

apply_midas = MidasDetector()

model = create_model('./models/cldm_v15.yaml').cpu()
model.load_state_dict(load_state_dict('./models/control_sd15_depth.pth', location='cuda'))
model = model.cuda()
ddim_sampler = DDIMSampler(model)


def process(input_image, prompt, a_prompt, n_p…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@bruibbruib
Comment options

@bruibbruib
Comment options

@kiriri
Comment options

@bruibbruib
Comment options

@BiuliaGonelli
Comment options

Answer selected by bruibbruib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants