Spaces:
Running
Running
Commit
•
26f2464
1
Parent(s):
d4bb4d3
chore: Update UI.py with improved variable names and formatting
Browse files
ui/ui.py
CHANGED
@@ -126,40 +126,40 @@ with gr.Blocks(theme='VikramSingh178/Webui-Theme') as demo:
|
|
126 |
with gr.Row():
|
127 |
with gr.Column():
|
128 |
with gr.Group():
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
|
137 |
with gr.Column(scale=1):
|
138 |
-
|
139 |
-
|
140 |
|
141 |
|
142 |
with gr.Tab("Inpainting"):
|
143 |
with gr.Row():
|
144 |
with gr.Column():
|
145 |
with gr.Group():
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
mode_kandinsky = gr.Dropdown(choices=["s3_json", "b64_json"], value="s3_json", label="Mode")
|
154 |
-
|
155 |
-
|
156 |
|
157 |
with gr.Column(scale=1):
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
inputs=[
|
163 |
-
outputs=[
|
164 |
|
165 |
demo.launch()
|
|
|
126 |
with gr.Row():
|
127 |
with gr.Column():
|
128 |
with gr.Group():
|
129 |
+
prompt = gr.Textbox(label="Prompt", placeholder="Enter your prompt here")
|
130 |
+
negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="Enter negative prompt here")
|
131 |
+
num_inference_steps = gr.Slider(minimum=1, maximum=1000, step=1, value=20, label="Inference Steps")
|
132 |
+
guidance_scale = gr.Slider(minimum=1.0, maximum=10.0, step=0.1, value=7.5, label="Guidance Scale")
|
133 |
+
num_images = gr.Slider(minimum=1, maximum=10, step=1, value=1, label="Number of Images")
|
134 |
+
mode = gr.Dropdown(choices=["s3_json", "b64_json"], value="s3_json", label="Mode")
|
135 |
+
generate_button = gr.Button("Generate Image", variant='primary')
|
136 |
|
137 |
with gr.Column(scale=1):
|
138 |
+
image_preview = gr.Image(label="Generated Image (SDXL-Lora)", show_download_button=True, show_share_button=True, container=True)
|
139 |
+
generate_button.click(generate_sdxl_lora_image, inputs=[prompt, negative_prompt, num_inference_steps, guidance_scale, num_images, mode], outputs=[image_preview])
|
140 |
|
141 |
|
142 |
with gr.Tab("Inpainting"):
|
143 |
with gr.Row():
|
144 |
with gr.Column():
|
145 |
with gr.Group():
|
146 |
+
masked_image = gr.ImageMask(label="Upload Image and Draw Mask", format='png')
|
147 |
+
prompt = gr.Textbox(label="Prompt", placeholder="Enter your prompt here")
|
148 |
+
negative_prompt= gr.Textbox(label="Negative Prompt", placeholder="Enter negative prompt here")
|
149 |
+
num_inference_steps = gr.Slider(minimum=1, maximum=100, step=1, value=20, label="Inference Steps")
|
150 |
+
strength = gr.Slider(minimum=0.1, maximum=1, step=0.1, value=0.8, label="Strength")
|
151 |
+
guidance_scale = gr.Slider(minimum=1.0, maximum=10.0, step=0.1, value=7.5, label="Guidance Scale")
|
152 |
+
num_images= gr.Slider(minimum=1, maximum=10, step=1, value=1, label="Number of Images")
|
153 |
mode_kandinsky = gr.Dropdown(choices=["s3_json", "b64_json"], value="s3_json", label="Mode")
|
154 |
+
generate_button = gr.Button("Generate Inpainting", variant='primary')
|
155 |
+
generate_mask_button_painting = gr.Button("Generate Mask", variant='secondary')
|
156 |
|
157 |
with gr.Column(scale=1):
|
158 |
+
mask_preview= gr.Image(label="Mask Preview", show_download_button=True, container=True)
|
159 |
+
outpainted_image_preview = gr.Image(label="Outpainted Image (Kandinsky)", show_download_button=True, show_share_button=True, container=True)
|
160 |
+
generate_mask_button_painting.click(generate_mask_preview, inputs=masked_image, outputs=[mask_preview])
|
161 |
+
generate_button.click(generate_outpainting,
|
162 |
+
inputs=[prompt, negative_prompt, num_inference_steps, strength, guidance_scale, mode_kandinsky, num_images, masked_image],
|
163 |
+
outputs=[mask_preview, outpainted_image_preview])
|
164 |
|
165 |
demo.launch()
|