Spaces:
Runtime error
Runtime error
angelahzyuan
commited on
Commit
•
e436174
1
Parent(s):
6f3e35c
update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
-
import cv2
|
3 |
from diffusers import StableDiffusionPipeline, UNet2DConditionModel
|
4 |
import torch
|
5 |
import random
|
6 |
import numpy as np
|
7 |
|
8 |
-
|
9 |
-
MODEL="/mnt/bn/ailab-yuningshen-psg/mlx/users/quanquan.gu/playground/trl/iter0_0_2.0e-5_linear200_new/checkpoints/checkpoint_0"
|
10 |
-
MODEL="/mnt/bn/ailab-yuningshen-psg/mlx/users/quanquan.gu/playground/trl/iter2_12h_5.0e-8_beta5_rep_wtie/checkpoints/checkpoint_10"
|
11 |
-
PROMPTS="/mnt/bn/ailab-yuningshen-psg/mlx/users/quanquan.gu/playground/trl/dataset/pickapic/pickapic_v2/validation_unique-00007_filtered.parquet"
|
12 |
-
NUM=1
|
13 |
-
|
14 |
-
|
15 |
|
16 |
def set_seed(seed=5775709):
|
17 |
random.seed(seed)
|
@@ -19,6 +12,7 @@ def set_seed(seed=5775709):
|
|
19 |
torch.manual_seed(seed)
|
20 |
torch.cuda.manual_seed(seed)
|
21 |
|
|
|
22 |
set_seed()
|
23 |
|
24 |
def get_pipeline(device='cuda'):
|
@@ -43,11 +37,6 @@ def generate(prompt: str, num_images: int=5, guidance_scale=7.5):
|
|
43 |
images = [x.resize((512, 512)) for x in images]
|
44 |
return images
|
45 |
|
46 |
-
def gen_image(args, image):
|
47 |
-
output = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
48 |
-
return output
|
49 |
-
|
50 |
-
|
51 |
|
52 |
|
53 |
with gr.Blocks() as demo:
|
@@ -76,4 +65,4 @@ with gr.Blocks() as demo:
|
|
76 |
generate_btn.click(fn=generate, inputs=[prompt_input, num_images_input, guidance_scale], outputs=gallery)
|
77 |
|
78 |
if __name__ == "__main__":
|
79 |
-
demo.launch(share=True)
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from diffusers import StableDiffusionPipeline, UNet2DConditionModel
|
3 |
import torch
|
4 |
import random
|
5 |
import numpy as np
|
6 |
|
7 |
+
MODEL="UCLA-AGI/SPIN-Diffusion-iter3"
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def set_seed(seed=5775709):
|
10 |
random.seed(seed)
|
|
|
12 |
torch.manual_seed(seed)
|
13 |
torch.cuda.manual_seed(seed)
|
14 |
|
15 |
+
|
16 |
set_seed()
|
17 |
|
18 |
def get_pipeline(device='cuda'):
|
|
|
37 |
images = [x.resize((512, 512)) for x in images]
|
38 |
return images
|
39 |
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
|
42 |
with gr.Blocks() as demo:
|
|
|
65 |
generate_btn.click(fn=generate, inputs=[prompt_input, num_images_input, guidance_scale], outputs=gallery)
|
66 |
|
67 |
if __name__ == "__main__":
|
68 |
+
demo.launch(share=True)
|