Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,17 +30,17 @@ def inference(source_prompt, target_prompt, source_guidance_scale=1, guidance_sc
|
|
30 |
ratio = min(height / img.height, width / img.width)
|
31 |
img = img.resize((int(img.width * ratio), int(img.height * ratio)))
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
return replace_nsfw_images(
|
44 |
|
45 |
|
46 |
def replace_nsfw_images(results):
|
@@ -60,7 +60,7 @@ with gr.Blocks(css=css) as demo:
|
|
60 |
<h1>CycleDiffusion with Stable Diffusion</h1>
|
61 |
</div>
|
62 |
<p>
|
63 |
-
Demo for CycleDiffusion with Stable Diffusion
|
64 |
<a href="https://huggingface.co/docs/diffusers/main/en/api/pipelines/cycle_diffusion">Pipeline doc</a> | <a href="https://arxiv.org/abs/2210.05559">Paper</a>
|
65 |
</p>
|
66 |
<p>You can skip the queue in the colab: <a href="https://colab.research.google.com/gist/ChenWu98/0aa4fe7be80f6b45d3d055df9f14353a/copy-of-fine-tuned-diffusion-gradio.ipynb"><img data-canonical-src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" src="https://colab.research.google.com/assets/colab-badge.svg"></a></p>
|
@@ -103,6 +103,7 @@ with gr.Blocks(css=css) as demo:
|
|
103 |
|
104 |
with gr.Row():
|
105 |
seed = gr.Slider(0, 2147483647, label='Seed', value=0, step=1)
|
|
|
106 |
generate = gr.Button(value="Edit")
|
107 |
|
108 |
inputs = [source_prompt, target_prompt, source_guidance_scale, guidance_scale, num_inference_steps,
|
@@ -118,8 +119,9 @@ with gr.Blocks(css=css) as demo:
|
|
118 |
image_out, inference, cache_examples=False)
|
119 |
|
120 |
gr.Markdown('''
|
121 |
-
Space by
|
122 |
-
|
|
|
123 |
![visitors](https://visitor-badge.glitch.me/badge?page_id=ChenWu98.CycleDiffusion)
|
124 |
''')
|
125 |
|
|
|
30 |
ratio = min(height / img.height, width / img.width)
|
31 |
img = img.resize((int(img.width * ratio), int(img.height * ratio)))
|
32 |
|
33 |
+
results = pipe(prompt=target_prompt,
|
34 |
+
source_prompt=source_prompt,
|
35 |
+
init_image=img,
|
36 |
+
num_inference_steps=num_inference_steps,
|
37 |
+
eta=0.1,
|
38 |
+
strength=strength,
|
39 |
+
guidance_scale=guidance_scale,
|
40 |
+
source_guidance_scale=source_guidance_scale,
|
41 |
+
)
|
42 |
|
43 |
+
return replace_nsfw_images(results)
|
44 |
|
45 |
|
46 |
def replace_nsfw_images(results):
|
|
|
60 |
<h1>CycleDiffusion with Stable Diffusion</h1>
|
61 |
</div>
|
62 |
<p>
|
63 |
+
Demo for CycleDiffusion with Stable Diffusion. <br>
|
64 |
<a href="https://huggingface.co/docs/diffusers/main/en/api/pipelines/cycle_diffusion">Pipeline doc</a> | <a href="https://arxiv.org/abs/2210.05559">Paper</a>
|
65 |
</p>
|
66 |
<p>You can skip the queue in the colab: <a href="https://colab.research.google.com/gist/ChenWu98/0aa4fe7be80f6b45d3d055df9f14353a/copy-of-fine-tuned-diffusion-gradio.ipynb"><img data-canonical-src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" src="https://colab.research.google.com/assets/colab-badge.svg"></a></p>
|
|
|
103 |
|
104 |
with gr.Row():
|
105 |
seed = gr.Slider(0, 2147483647, label='Seed', value=0, step=1)
|
106 |
+
with gr.Row():
|
107 |
generate = gr.Button(value="Edit")
|
108 |
|
109 |
inputs = [source_prompt, target_prompt, source_guidance_scale, guidance_scale, num_inference_steps,
|
|
|
119 |
image_out, inference, cache_examples=False)
|
120 |
|
121 |
gr.Markdown('''
|
122 |
+
Space built with Diffusers 𧨠by HuggingFace π€.
|
123 |
+
[<img src="https://img.shields.io/twitter/follow/ChenHenryWu?style=social">](https://twitter.com/ChenHenryWu)
|
124 |
+
|
125 |
![visitors](https://visitor-badge.glitch.me/badge?page_id=ChenWu98.CycleDiffusion)
|
126 |
''')
|
127 |
|