asahi417 commited on
Commit
b62287c
·
verified ·
1 Parent(s): 84a2328

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +2 -21
app.py CHANGED
@@ -1,13 +1,10 @@
1
- # import torch
2
  import gradio as gr
 
3
  from diffusers.utils import load_image
4
  import spaces
5
  from panna.pipeline import PipelineDepth2ImageV2
6
- # from panna import Depth2Image, DepthAnythingV2
7
 
8
- model = PipelineDepth2ImageV2()
9
- # model_depth = DepthAnythingV2()
10
- # model_image = Depth2Image()
11
  title = ("# [Depth2Image](https://huggingface.co/stabilityai/stable-diffusion-2-depth) with [DepthAnythingV2](https://huggingface.co/depth-anything/Depth-Anything-V2-Large-hf)\n"
12
  "Depth2Image with depth map predicted by DepthAnything V2. The demo is part of [panna](https://github.com/abacws-abacus/panna) project.")
13
  example_files = []
@@ -16,22 +13,6 @@ for n in range(1, 10):
16
  example_files.append(f"demo{n:0>2}.jpg")
17
 
18
 
19
- # @spaces.GPU
20
- # def infer(init_image, prompt, negative_prompt, seed, width, height, guidance_scale, num_inference_steps):
21
- # depth = model_depth.image2depth([init_image], return_tensor=True)
22
- # return model_image.text2image(
23
- # [init_image],
24
- # depth_maps=depth,
25
- # prompt=[prompt],
26
- # negative_prompt=[negative_prompt],
27
- # guidance_scale=guidance_scale,
28
- # num_inference_steps=num_inference_steps,
29
- # height=height,
30
- # width=width,
31
- # seed=seed
32
- # )[0]
33
-
34
-
35
  @spaces.GPU
36
  def infer(init_image, prompt, negative_prompt, seed, width, height, guidance_scale, num_inference_steps):
37
  return model(
 
 
1
  import gradio as gr
2
+ import torch
3
  from diffusers.utils import load_image
4
  import spaces
5
  from panna.pipeline import PipelineDepth2ImageV2
 
6
 
7
+ model = PipelineDepth2ImageV2(torch_dtype=torch.float32)
 
 
8
  title = ("# [Depth2Image](https://huggingface.co/stabilityai/stable-diffusion-2-depth) with [DepthAnythingV2](https://huggingface.co/depth-anything/Depth-Anything-V2-Large-hf)\n"
9
  "Depth2Image with depth map predicted by DepthAnything V2. The demo is part of [panna](https://github.com/abacws-abacus/panna) project.")
10
  example_files = []
 
13
  example_files.append(f"demo{n:0>2}.jpg")
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  @spaces.GPU
17
  def infer(init_image, prompt, negative_prompt, seed, width, height, guidance_scale, num_inference_steps):
18
  return model(