Update app.py
Browse files
app.py
CHANGED
@@ -28,21 +28,22 @@ pipe = ChatsSDXLPipeline.from_pretrained(
|
|
28 |
pipe.to(DEVICE)
|
29 |
|
30 |
@spaces.GPU(duration=75)
|
31 |
-
def generate(prompt, seed, randomize_seed=False, steps=50, guidance_scale=
|
32 |
if randomize_seed:
|
33 |
seed = random.randint(0, MAX_SEED)
|
34 |
-
|
|
|
35 |
output = pipe(
|
36 |
prompt=prompt,
|
37 |
num_inference_steps=steps,
|
38 |
guidance_scale=guidance_scale,
|
39 |
seed=seed
|
40 |
)
|
41 |
-
return output['images']
|
42 |
|
43 |
examples = [
|
44 |
-
"The image is a digital art headshot of an owlfolk character with high detail and dramatic lighting",
|
45 |
"Solar punk vehicle in a bustling city",
|
|
|
46 |
"An elderly woman poses for a high fashion photoshoot in colorful, patterned clothes with a cyberpunk 2077 vibe",
|
47 |
]
|
48 |
|
@@ -57,7 +58,7 @@ with gr.Blocks(css=css) as demo:
|
|
57 |
|
58 |
with gr.Column(elem_id="col-container"):
|
59 |
gr.Markdown(f"""# CHATS-SDXL
|
60 |
-
SDXL diffusion models finetuned using preference optimization framework CHATS. [[paper]
|
61 |
""")
|
62 |
|
63 |
with gr.Row():
|
@@ -84,7 +85,7 @@ SDXL diffusion models finetuned using preference optimization framework CHATS. [
|
|
84 |
value=0,
|
85 |
)
|
86 |
|
87 |
-
randomize_seed = gr.Checkbox(label="Randomize seed", value=
|
88 |
|
89 |
with gr.Row():
|
90 |
|
|
|
28 |
pipe.to(DEVICE)
|
29 |
|
30 |
@spaces.GPU(duration=75)
|
31 |
+
def generate(prompt, seed=0, randomize_seed=False, steps=50, guidance_scale=5.0):
|
32 |
if randomize_seed:
|
33 |
seed = random.randint(0, MAX_SEED)
|
34 |
+
|
35 |
+
print('inference with prompt : {}, seed : {}, step : {}, cfg : {}'.format(prompt, seed, steps, guidance_scale))
|
36 |
output = pipe(
|
37 |
prompt=prompt,
|
38 |
num_inference_steps=steps,
|
39 |
guidance_scale=guidance_scale,
|
40 |
seed=seed
|
41 |
)
|
42 |
+
return output['images'][0]
|
43 |
|
44 |
examples = [
|
|
|
45 |
"Solar punk vehicle in a bustling city",
|
46 |
+
"An anthropomorphic cat riding a Harley Davidson in Arizona with sunglasses and a leather jacket",
|
47 |
"An elderly woman poses for a high fashion photoshoot in colorful, patterned clothes with a cyberpunk 2077 vibe",
|
48 |
]
|
49 |
|
|
|
58 |
|
59 |
with gr.Column(elem_id="col-container"):
|
60 |
gr.Markdown(f"""# CHATS-SDXL
|
61 |
+
SDXL diffusion models finetuned using preference optimization framework CHATS. [[paper](https://arxiv.org/pdf/2502.12579)] [[code](https://github.com/AIDC-AI/CHATS)] [[model](https://huggingface.co/AIDC-AI/CHATS)]
|
62 |
""")
|
63 |
|
64 |
with gr.Row():
|
|
|
85 |
value=0,
|
86 |
)
|
87 |
|
88 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=False)
|
89 |
|
90 |
with gr.Row():
|
91 |
|