VikramSingh178 commited on
Commit
26f2464
1 Parent(s): d4bb4d3

chore: Update UI.py with improved variable names and formatting

Browse files
Files changed (1) hide show
  1. ui/ui.py +24 -24
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
- prompt_sdxl = gr.Textbox(label="Prompt", placeholder="Enter your prompt here")
130
- negative_prompt_sdxl = gr.Textbox(label="Negative Prompt", placeholder="Enter negative prompt here")
131
- num_inference_steps_sdxl = gr.Slider(minimum=1, maximum=1000, step=1, value=20, label="Inference Steps")
132
- guidance_scale_sdxl = gr.Slider(minimum=1.0, maximum=10.0, step=0.1, value=7.5, label="Guidance Scale")
133
- num_images_sdxl = gr.Slider(minimum=1, maximum=10, step=1, value=1, label="Number of Images")
134
- mode_sdxl = gr.Dropdown(choices=["s3_json", "b64_json"], value="s3_json", label="Mode")
135
- generate_button_sdxl = gr.Button("Generate Image", variant='primary')
136
 
137
  with gr.Column(scale=1):
138
- image_preview_sdxl = gr.Image(label="Generated Image (SDXL-Lora)", show_download_button=True, show_share_button=True, container=True)
139
- generate_button_sdxl.click(generate_sdxl_lora_image, inputs=[prompt_sdxl, negative_prompt_sdxl, num_inference_steps_sdxl, guidance_scale_sdxl, num_images_sdxl, mode_sdxl], outputs=[image_preview_sdxl])
140
 
141
 
142
  with gr.Tab("Inpainting"):
143
  with gr.Row():
144
  with gr.Column():
145
  with gr.Group():
146
- masked_image_kandinsky = gr.ImageMask(label="Upload Image and Draw Mask", format='png')
147
- prompt_kandinsky = gr.Textbox(label="Prompt", placeholder="Enter your prompt here")
148
- negative_prompt_kandinsky = gr.Textbox(label="Negative Prompt", placeholder="Enter negative prompt here")
149
- num_inference_steps_kandinsky = gr.Slider(minimum=1, maximum=100, step=1, value=20, label="Inference Steps")
150
- strength_kandinsky = gr.Slider(minimum=0.1, maximum=1, step=0.1, value=0.8, label="Strength")
151
- guidance_scale_kandinsky = gr.Slider(minimum=1.0, maximum=10.0, step=0.1, value=7.5, label="Guidance Scale")
152
- num_images_kandinsky = 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_kandinsky = gr.Button("Generate Inpainting", variant='primary')
155
- generate_mask_button_kandinsky = gr.Button("Generate Mask", variant='secondary')
156
 
157
  with gr.Column(scale=1):
158
- mask_preview_kandinsky = gr.Image(label="Mask Preview", show_download_button=True, container=True)
159
- outpainted_image_preview_kandinsky = gr.Image(label="Outpainted Image (Kandinsky)", show_download_button=True, show_share_button=True, container=True)
160
- generate_mask_button_kandinsky.click(generate_mask_preview, inputs=masked_image_kandinsky, outputs=[mask_preview_kandinsky])
161
- generate_button_kandinsky.click(generate_outpainting,
162
- inputs=[prompt_kandinsky, negative_prompt_kandinsky, num_inference_steps_kandinsky, strength_kandinsky, guidance_scale_kandinsky, mode_kandinsky, num_images_kandinsky, masked_image_kandinsky],
163
- outputs=[mask_preview_kandinsky, outpainted_image_preview_kandinsky])
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()