Spaces:
Running
on
Zero
Running
on
Zero
added prompt
Browse files
app.py
CHANGED
@@ -44,17 +44,17 @@ pipe = StableDiffusionXLFillPipeline.from_pretrained(
|
|
44 |
|
45 |
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
|
46 |
|
47 |
-
prompt = "high quality"
|
48 |
-
(
|
49 |
-
prompt_embeds,
|
50 |
-
negative_prompt_embeds,
|
51 |
-
pooled_prompt_embeds,
|
52 |
-
negative_pooled_prompt_embeds,
|
53 |
-
) = pipe.encode_prompt(prompt, "cuda", True)
|
54 |
|
55 |
|
56 |
@spaces.GPU(duration=16)
|
57 |
-
def fill_image(image, model_selection):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
source = image["background"]
|
59 |
mask = image["layers"][0]
|
60 |
|
@@ -112,6 +112,7 @@ with gr.Blocks(css=css) as demo:
|
|
112 |
interactive=False,
|
113 |
label="Generated Image",
|
114 |
)
|
|
|
115 |
|
116 |
model_selection = gr.Dropdown(
|
117 |
choices=list(MODELS.keys()),
|
@@ -125,7 +126,7 @@ with gr.Blocks(css=css) as demo:
|
|
125 |
outputs=result,
|
126 |
).then(
|
127 |
fn=fill_image,
|
128 |
-
inputs=[input_image, model_selection],
|
129 |
outputs=result,
|
130 |
)
|
131 |
|
|
|
44 |
|
45 |
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
|
49 |
@spaces.GPU(duration=16)
|
50 |
+
def fill_image(image, model_selection,prompt):
|
51 |
+
(
|
52 |
+
prompt_embeds,
|
53 |
+
negative_prompt_embeds,
|
54 |
+
pooled_prompt_embeds,
|
55 |
+
negative_pooled_prompt_embeds,
|
56 |
+
) = pipe.encode_prompt(prompt, "cuda", True)
|
57 |
+
|
58 |
source = image["background"]
|
59 |
mask = image["layers"][0]
|
60 |
|
|
|
112 |
interactive=False,
|
113 |
label="Generated Image",
|
114 |
)
|
115 |
+
prompt = gr.Textbox(placeholder="Flip this text")
|
116 |
|
117 |
model_selection = gr.Dropdown(
|
118 |
choices=list(MODELS.keys()),
|
|
|
126 |
outputs=result,
|
127 |
).then(
|
128 |
fn=fill_image,
|
129 |
+
inputs=[input_image, model_selection,prompt],
|
130 |
outputs=result,
|
131 |
)
|
132 |
|