Spaces:
Running
on
Zero
Running
on
Zero
MCP ready
Browse files
app.py
CHANGED
@@ -25,6 +25,21 @@ pipeline.enable_vae_slicing()
|
|
25 |
|
26 |
@spaces.GPU(duration=60)
|
27 |
def run(ref_path, ref_style, ref_prompt, prompt1, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
# DDIM inversion
|
29 |
src_style = f"{ref_style}"
|
30 |
src_prompt = f"{ref_prompt}, {src_style}."
|
@@ -137,4 +152,4 @@ with gr.Blocks(css=css) as demo:
|
|
137 |
]
|
138 |
)
|
139 |
|
140 |
-
demo.queue().launch()
|
|
|
25 |
|
26 |
@spaces.GPU(duration=60)
|
27 |
def run(ref_path, ref_style, ref_prompt, prompt1, progress=gr.Progress(track_tqdm=True)):
|
28 |
+
"""Generate an image in the style of a reference image using the StyleAligned method.
|
29 |
+
|
30 |
+
This function performs DDIM inversion on a reference image to capture its latent representation
|
31 |
+
and then applies the StyleAligned diffusion technique to transfer the style to a new prompt.
|
32 |
+
|
33 |
+
Args:
|
34 |
+
ref_path: File path to the reference image.
|
35 |
+
ref_style: Textual description of the reference style (e.g., 'medieval painting').
|
36 |
+
ref_prompt: Description of the content in the reference image.
|
37 |
+
prompt1: The prompt describing the new image to be generated with the same style.
|
38 |
+
progress: Internal Gradio progress tracker (automatically handled).
|
39 |
+
|
40 |
+
Returns:
|
41 |
+
A list of generated images with the style of the reference image applied to the new prompt.
|
42 |
+
"""
|
43 |
# DDIM inversion
|
44 |
src_style = f"{ref_style}"
|
45 |
src_prompt = f"{ref_prompt}, {src_style}."
|
|
|
152 |
]
|
153 |
)
|
154 |
|
155 |
+
demo.queue().launch(ssr_mode=False, mcp_server=True)
|