yrr commited on
Commit
1876385
1 Parent(s): 6128ddf
app.py CHANGED
@@ -1,14 +1,17 @@
1
  import gradio as gr
2
  from PIL import Image
3
  import os
 
4
 
5
- os.environ['CUDA_VISIBLE_DEVICES'] = '7'
6
 
7
  from OmniGen import OmniGenPipeline
8
 
9
  pipe = OmniGenPipeline.from_pretrained("shitao/tmp-preview")
 
10
 
11
  # 示例处理函数:生成图像
 
12
  def generate_image(text, img1, img2, img3, height, width, guidance_scale):
13
  input_images = [img1, img2, img3]
14
  # 去除 None
 
1
  import gradio as gr
2
  from PIL import Image
3
  import os
4
+ import spaces
5
 
6
+ # os.environ['CUDA_VISIBLE_DEVICES'] = '7'
7
 
8
  from OmniGen import OmniGenPipeline
9
 
10
  pipe = OmniGenPipeline.from_pretrained("shitao/tmp-preview")
11
+ pipe.to("cuda")
12
 
13
  # 示例处理函数:生成图像
14
+ @spaces.GPU
15
  def generate_image(text, img1, img2, img3, height, width, guidance_scale):
16
  input_images = [img1, img2, img3]
17
  # 去除 None
imgs/test_cases/img1.jpg ADDED

Git LFS Details

  • SHA256: f0036a7c89f60de3366afc6fffedf52be91cf91da36b2fb9b1722e641debfeb7
  • Pointer size: 131 Bytes
  • Size of remote file: 176 kB
imgs/test_cases/img2.jpg ADDED

Git LFS Details

  • SHA256: 999845fb0e781cc8b9db0e9407ad6d4a528dc08677caec3fcc9f6ad6afc718bc
  • Pointer size: 131 Bytes
  • Size of remote file: 175 kB
imgs/test_cases/img3.jpg ADDED

Git LFS Details

  • SHA256: c1d2ba59e30efb043f77644c2fc9f59082899dcfe6a26cbf803de32c9eafff18
  • Pointer size: 131 Bytes
  • Size of remote file: 166 kB