yrr
commited on
Commit
•
1876385
1
Parent(s):
6128ddf
zero gpu
Browse files- app.py +4 -1
- imgs/test_cases/img1.jpg +3 -0
- imgs/test_cases/img2.jpg +3 -0
- imgs/test_cases/img3.jpg +3 -0
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
|
imgs/test_cases/img2.jpg
ADDED
Git LFS Details
|
imgs/test_cases/img3.jpg
ADDED
Git LFS Details
|