Spaces:
Runtime error
Runtime error
Commit
·
46c5b00
1
Parent(s):
d1c2665
update
Browse files
app.py
CHANGED
@@ -50,8 +50,8 @@ def run_normal(prompt, negative_prompt="", guidance_scale=7, progress=gr.Progres
|
|
50 |
return pipe_normal(prompt, negative_prompt=negative_prompt, guidance_scale=guidance_scale, num_inference_steps=20).images[0]
|
51 |
|
52 |
#@spaces.GPU
|
53 |
-
def run_edit(image, prompt, negative_prompt="", guidance_scale=7, progress=gr.Progress(track_tqdm=True)):
|
54 |
-
resolution = 1024
|
55 |
image.resize((resolution, resolution))
|
56 |
return pipe_edit(prompt=prompt,image=image,height=resolution,width=resolution,negative_prompt=negative_prompt, guidance_scale=guidance_scale,num_inference_steps=20).images[0]
|
57 |
css = '''
|
@@ -70,13 +70,14 @@ with gr.Blocks(css=css) as demo:
|
|
70 |
with gr.Group():
|
71 |
image_edit = gr.Image(label="Image you would like to edit", type="pil")
|
72 |
with gr.Row():
|
73 |
-
prompt_edit = gr.Textbox(
|
|
|
74 |
button_edit = gr.Button("Generate", min_width=120)
|
75 |
output_edit = gr.Image(label="Your result image", interactive=False)
|
76 |
with gr.Accordion("Advanced Settings", open=False):
|
77 |
negative_prompt_edit = gr.Textbox(label="Negative Prompt")
|
78 |
guidance_scale_edit = gr.Number(label="Guidance Scale", value=7)
|
79 |
-
gr.Examples(examples=edit_examples, fn=run_edit, inputs=[image_edit, prompt_edit], outputs=[output_edit], cache_examples=False)
|
80 |
with gr.Tab("CosXL"):
|
81 |
with gr.Group():
|
82 |
with gr.Row():
|
@@ -105,7 +106,7 @@ with gr.Blocks(css=css) as demo:
|
|
105 |
prompt_edit.submit
|
106 |
],
|
107 |
fn=run_edit,
|
108 |
-
inputs=[image_edit, prompt_edit, negative_prompt_edit, guidance_scale_edit],
|
109 |
outputs=[output_edit]
|
110 |
)
|
111 |
if __name__ == "__main__":
|
|
|
50 |
return pipe_normal(prompt, negative_prompt=negative_prompt, guidance_scale=guidance_scale, num_inference_steps=20).images[0]
|
51 |
|
52 |
#@spaces.GPU
|
53 |
+
def run_edit(image, prompt, resolution, negative_prompt="", guidance_scale=7, progress=gr.Progress(track_tqdm=True)):
|
54 |
+
#resolution = 1024
|
55 |
image.resize((resolution, resolution))
|
56 |
return pipe_edit(prompt=prompt,image=image,height=resolution,width=resolution,negative_prompt=negative_prompt, guidance_scale=guidance_scale,num_inference_steps=20).images[0]
|
57 |
css = '''
|
|
|
70 |
with gr.Group():
|
71 |
image_edit = gr.Image(label="Image you would like to edit", type="pil")
|
72 |
with gr.Row():
|
73 |
+
prompt_edit = gr.Textbox(label="Prompt", scale=4, placeholder="Edit instructions, e.g.: Make the day cloudy")
|
74 |
+
size_edit = gr.Number(label="Size", value=1024, maximum=1024, minimum=512, precision=0)
|
75 |
button_edit = gr.Button("Generate", min_width=120)
|
76 |
output_edit = gr.Image(label="Your result image", interactive=False)
|
77 |
with gr.Accordion("Advanced Settings", open=False):
|
78 |
negative_prompt_edit = gr.Textbox(label="Negative Prompt")
|
79 |
guidance_scale_edit = gr.Number(label="Guidance Scale", value=7)
|
80 |
+
gr.Examples(examples=edit_examples, fn=run_edit, inputs=[image_edit, prompt_edit, size_edit], outputs=[output_edit], cache_examples=False)
|
81 |
with gr.Tab("CosXL"):
|
82 |
with gr.Group():
|
83 |
with gr.Row():
|
|
|
106 |
prompt_edit.submit
|
107 |
],
|
108 |
fn=run_edit,
|
109 |
+
inputs=[image_edit, prompt_edit, size_edit, negative_prompt_edit, guidance_scale_edit],
|
110 |
outputs=[output_edit]
|
111 |
)
|
112 |
if __name__ == "__main__":
|