Spaces:
Runtime error
Runtime error
Add demo files.
Browse files- README.md +1 -1
- app.py +38 -0
- requirements.txt +4 -0
README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
---
|
2 |
title: Wuerstchen Test
|
3 |
-
emoji:
|
4 |
colorFrom: green
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
|
|
1 |
---
|
2 |
title: Wuerstchen Test
|
3 |
+
emoji: 🌭
|
4 |
colorFrom: green
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
app.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from diffusers import AutoPipelineForText2Image
|
3 |
+
from diffusers.pipelines.wuerstchen import DEFAULT_STAGE_C_TIMESTEPS
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
+
if torch.cuda.is_available():
|
7 |
+
pipe = AutoPipelineForText2Image.from_pretrained("warp-ai/wuerstchen", torch_dtype=torch.float16).to("cuda")
|
8 |
+
else:
|
9 |
+
pipe = AutoPipelineForText2Image.from_pretrained("warp-ai/wuerstchen")
|
10 |
+
|
11 |
+
def gen_image(caption):
|
12 |
+
# caption = "Anthropomorphic fox dressed as a fire fighter"
|
13 |
+
# fantasy art of a band of brothers human cleric by greg rutkowski
|
14 |
+
images = pipe(
|
15 |
+
caption,
|
16 |
+
width=1024,
|
17 |
+
height=1536,
|
18 |
+
prior_timesteps=DEFAULT_STAGE_C_TIMESTEPS,
|
19 |
+
prior_guidance_scale=4.0,
|
20 |
+
num_images_per_prompt=1,
|
21 |
+
).images
|
22 |
+
return images[0]
|
23 |
+
|
24 |
+
|
25 |
+
# Once primed, 1024 x 1536 images are generated in ~6 seconds on my machine; quality is so-so but similar to SD 1.5
|
26 |
+
with gr.Blocks() as demo:
|
27 |
+
gr.Markdown("# Test of the Wueurstchen Model")
|
28 |
+
with gr.Row():
|
29 |
+
with gr.Column():
|
30 |
+
in_text = gr.Textbox(value="Enter a prompt here")
|
31 |
+
run_button = gr.Button(variant="primary")
|
32 |
+
with gr.Column():
|
33 |
+
out_image = gr.Image(label="Image Output")
|
34 |
+
|
35 |
+
run_button.click(gen_image, [in_text], [out_image], None)
|
36 |
+
|
37 |
+
if __name__ == '__main__':
|
38 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
accelerate
|
2 |
+
diffusers
|
3 |
+
torch
|
4 |
+
transformers
|