Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ from PIL import Image
|
|
| 5 |
from diffusers.models import AutoencoderKL
|
| 6 |
from diffusers import AutoPipelineForInpainting, UNet2DConditionModel, DiffusionPipeline
|
| 7 |
import diffusers
|
| 8 |
-
|
| 9 |
|
| 10 |
|
| 11 |
vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse")
|
|
@@ -91,17 +91,7 @@ css = '''
|
|
| 91 |
transform: rotate(360deg);
|
| 92 |
}
|
| 93 |
}
|
| 94 |
-
#share-btn-container {padding-left: 0.5rem !important; padding-right: 0.5rem !important; background-color: #000000; justify-content: center; align-items: center; border-radius: 9999px !important; max-width: 13rem; margin-left: auto;}
|
| 95 |
-
div#share-btn-container > div {flex-direction: row;background: black;align-items: center}
|
| 96 |
-
#share-btn-container:hover {background-color: #060606}
|
| 97 |
-
#share-btn {all: initial; color: #ffffff;font-weight: 600; cursor:pointer; font-family: 'IBM Plex Sans', sans-serif; margin-left: 0.5rem !important; padding-top: 0.5rem !important; padding-bottom: 0.5rem !important;right:0;}
|
| 98 |
-
#share-btn * {all: unset}
|
| 99 |
-
#share-btn-container div:nth-child(-n+2){width: auto !important;min-height: 0px !important;}
|
| 100 |
-
#share-btn-container .wrap {display: none !important}
|
| 101 |
-
#share-btn-container.hidden {display: none!important}
|
| 102 |
#prompt input{width: calc(100% - 160px);border-top-right-radius: 0px;border-bottom-right-radius: 0px;}
|
| 103 |
-
#run_button{position:absolute;margin-top: 11px;right: 0;margin-right: 0.8em;border-bottom-left-radius: 0px;
|
| 104 |
-
border-top-left-radius: 0px;}
|
| 105 |
#prompt-container{margin-top:-18px;}
|
| 106 |
#prompt-container .form{border-top-left-radius: 0;border-top-right-radius: 0}
|
| 107 |
#image_upload{border-bottom-left-radius: 0px;border-bottom-right-radius: 0px}
|
|
@@ -116,6 +106,7 @@ with image_blocks as demo:
|
|
| 116 |
with gr.Row(elem_id="prompt-container",equal_height=True):
|
| 117 |
with gr.Row():
|
| 118 |
prompt = gr.Textbox(placeholder="Your prompt", show_label=False, elem_id="prompt", lines=5, allow_resize=True)
|
|
|
|
| 119 |
btn = gr.Button("Inpaint!", elem_id="run_button")
|
| 120 |
|
| 121 |
with gr.Accordion(label="Advanced Settings", open=False):
|
|
@@ -124,21 +115,20 @@ with image_blocks as demo:
|
|
| 124 |
steps = gr.Number(value=40, minimum=10, maximum=100, step=1, label="steps")
|
| 125 |
strength = gr.Number(value=0.8, minimum=0.01, maximum=1.0, step=0.01, label="strength")
|
| 126 |
negative_prompt = gr.Textbox(label="negative_prompt", placeholder="Your negative prompt", info="what you don't want to see in the image")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
with gr.Row(equal_height=True):
|
| 128 |
schedulers = ["DEISMultistepScheduler", "HeunDiscreteScheduler", "EulerDiscreteScheduler", "DPMSolverMultistepScheduler", "DPMSolverMultistepScheduler-Karras", "DPMSolverMultistepScheduler-Karras-SDE"]
|
| 129 |
scheduler = gr.Dropdown(label="Schedulers", choices=schedulers, value="DPMSolverMultistepScheduler-Karras")
|
| 130 |
|
| 131 |
with gr.Column():
|
| 132 |
image_out = gr.Image(label="Output", elem_id="output-img", height=512, width=512)
|
| 133 |
-
with gr.Group(elem_id="share-btn-container", visible=False) as share_btn_container:
|
| 134 |
-
community_icon = gr.HTML(community_icon_html)
|
| 135 |
-
loading_icon = gr.HTML(loading_icon_html)
|
| 136 |
-
share_button = gr.Button("Share to community", elem_id="share-btn",visible=False)
|
| 137 |
|
| 138 |
|
| 139 |
-
btn.click(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, scheduler], outputs=[image_out
|
| 140 |
-
prompt.submit(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, scheduler], outputs=[image_out
|
| 141 |
-
share_button.click(None, [], [], _js=share_js)
|
| 142 |
|
| 143 |
|
| 144 |
image_blocks.queue(max_size=25,api_open=True).launch(show_api=True)
|
|
|
|
| 5 |
from diffusers.models import AutoencoderKL
|
| 6 |
from diffusers import AutoPipelineForInpainting, UNet2DConditionModel, DiffusionPipeline
|
| 7 |
import diffusers
|
| 8 |
+
|
| 9 |
|
| 10 |
|
| 11 |
vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse")
|
|
|
|
| 91 |
transform: rotate(360deg);
|
| 92 |
}
|
| 93 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
#prompt input{width: calc(100% - 160px);border-top-right-radius: 0px;border-bottom-right-radius: 0px;}
|
|
|
|
|
|
|
| 95 |
#prompt-container{margin-top:-18px;}
|
| 96 |
#prompt-container .form{border-top-left-radius: 0;border-top-right-radius: 0}
|
| 97 |
#image_upload{border-bottom-left-radius: 0px;border-bottom-right-radius: 0px}
|
|
|
|
| 106 |
with gr.Row(elem_id="prompt-container",equal_height=True):
|
| 107 |
with gr.Row():
|
| 108 |
prompt = gr.Textbox(placeholder="Your prompt", show_label=False, elem_id="prompt", lines=5, allow_resize=True)
|
| 109 |
+
with gr.Row():
|
| 110 |
btn = gr.Button("Inpaint!", elem_id="run_button")
|
| 111 |
|
| 112 |
with gr.Accordion(label="Advanced Settings", open=False):
|
|
|
|
| 115 |
steps = gr.Number(value=40, minimum=10, maximum=100, step=1, label="steps")
|
| 116 |
strength = gr.Number(value=0.8, minimum=0.01, maximum=1.0, step=0.01, label="strength")
|
| 117 |
negative_prompt = gr.Textbox(label="negative_prompt", placeholder="Your negative prompt", info="what you don't want to see in the image")
|
| 118 |
+
|
| 119 |
+
with gr.Row(equal_height=True):
|
| 120 |
+
models = ["Realistic_V5.0","Realistic_V5.1","Realistic_V6.0","Epic_Realism"]
|
| 121 |
+
model = gr.Dropdown(label="Models",choices=models,value="Realistic_V5.0")
|
| 122 |
with gr.Row(equal_height=True):
|
| 123 |
schedulers = ["DEISMultistepScheduler", "HeunDiscreteScheduler", "EulerDiscreteScheduler", "DPMSolverMultistepScheduler", "DPMSolverMultistepScheduler-Karras", "DPMSolverMultistepScheduler-Karras-SDE"]
|
| 124 |
scheduler = gr.Dropdown(label="Schedulers", choices=schedulers, value="DPMSolverMultistepScheduler-Karras")
|
| 125 |
|
| 126 |
with gr.Column():
|
| 127 |
image_out = gr.Image(label="Output", elem_id="output-img", height=512, width=512)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
|
| 130 |
+
btn.click(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, model, scheduler], outputs=[image_out], api_name='run')
|
| 131 |
+
prompt.submit(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, model, scheduler], outputs=[image_out])
|
|
|
|
| 132 |
|
| 133 |
|
| 134 |
image_blocks.queue(max_size=25,api_open=True).launch(show_api=True)
|