Ashoka74 commited on
Commit
dbd1dcc
1 Parent(s): 2d16f46

Update app_3.py

Browse files
Files changed (1) hide show
  1. app_3.py +57 -49
app_3.py CHANGED
@@ -1287,32 +1287,41 @@ with block:
1287
  extracted_fg = gr.Image(type="pil", label="Extracted Foreground", height=480)
1288
  angles_fg = gr.Image(type="pil", label="Converted Foreground", height=480, visible=False)
1289
 
1290
- with gr.Row():
1291
- with gr.Group():
1292
- run_button = gr.Button("Generate alternative angles")
1293
- orientation_result = gr.Gallery(
1294
- label="Result",
1295
- show_label=False,
1296
- columns=[3],
1297
- rows=[2],
1298
- object_fit="fill",
1299
- height="auto",
1300
- allow_preview=False,
1301
- )
1302
-
1303
- if orientation_result:
1304
- #selected = gr.Number(visible=False)
1305
- orientation_result.select(use_orientation, inputs=None, outputs=extracted_fg)
1306
 
1307
  # output_bg = gr.Image(type="numpy", label="Preprocessed Foreground", height=480)
1308
  with gr.Group():
1309
- prompt = gr.Textbox(label="Prompt")
1310
- bg_source = gr.Radio(choices=[e.value for e in list(BGSource)[2:]],
1311
- value=BGSource.LEFT.value,
1312
- label="Lighting Preference (Initial Latent)", type='value')
1313
- example_quick_subjects = gr.Dataset(samples=quick_subjects, label='Subject Quick List', samples_per_page=1000, components=[prompt])
1314
- example_quick_prompts = gr.Dataset(samples=quick_prompts, label='Lighting Quick List', samples_per_page=1000, components=[prompt])
1315
- relight_button = gr.Button(value="Relight")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1316
 
1317
  with gr.Group(visible=False):
1318
  with gr.Row():
@@ -1323,32 +1332,31 @@ with block:
1323
  image_width = gr.Slider(label="Image Width", minimum=256, maximum=1024, value=512, step=64)
1324
  image_height = gr.Slider(label="Image Height", minimum=256, maximum=1024, value=640, step=64)
1325
 
1326
- with gr.Accordion("Advanced options", open=False):
1327
- steps = gr.Slider(label="Steps", minimum=1, maximum=100, value=15, step=1)
1328
- cfg = gr.Slider(label="CFG Scale", minimum=1.0, maximum=32.0, value=2, step=0.01, visible=False)
1329
- lowres_denoise = gr.Slider(label="Lowres Denoise (for initial latent)", minimum=0.1, maximum=1.0, value=0.9, step=0.01)
1330
- highres_scale = gr.Slider(label="Highres Scale", minimum=1.0, maximum=3.0, value=1.5, step=0.01)
1331
- highres_denoise = gr.Slider(label="Highres Denoise", minimum=0.1, maximum=1.0, value=0.5, step=0.01)
1332
- a_prompt = gr.Textbox(label="Added Prompt", value='best quality', visible=False)
1333
- n_prompt = gr.Textbox(label="Negative Prompt", value='lowres, bad anatomy, bad hands, cropped, worst quality', visible=False)
1334
- x_slider = gr.Slider(
1335
- minimum=0,
1336
- maximum=1000,
1337
- label="X Position",
1338
- value=500,
1339
- visible=False
1340
- )
1341
- y_slider = gr.Slider(
1342
- minimum=0,
1343
- maximum=1000,
1344
- label="Y Position",
1345
- value=500,
1346
- visible=False
1347
- )
1348
- with gr.Column():
1349
- result_gallery = gr.Gallery(height=832, object_fit='contain', label='Outputs')
1350
- with gr.Row():
1351
- dummy_image_for_outputs = gr.Image(visible=False, label='Result')
1352
  # gr.Examples(
1353
  # fn=lambda *args: ([args[-1]], None),
1354
  # examples=db_examples.foreground_conditioned_examples,
 
1287
  extracted_fg = gr.Image(type="pil", label="Extracted Foreground", height=480)
1288
  angles_fg = gr.Image(type="pil", label="Converted Foreground", height=480, visible=False)
1289
 
1290
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1291
 
1292
  # output_bg = gr.Image(type="numpy", label="Preprocessed Foreground", height=480)
1293
  with gr.Group():
1294
+ run_button = gr.Button("Generate alternative angles")
1295
+ orientation_result = gr.Gallery(
1296
+ label="Result",
1297
+ show_label=False,
1298
+ columns=[3],
1299
+ rows=[2],
1300
+ object_fit="fill",
1301
+ height="auto",
1302
+ allow_preview=False,
1303
+ )
1304
+
1305
+ if orientation_result:
1306
+ orientation_result.select(use_orientation, inputs=None, outputs=extracted_fg)
1307
+
1308
+ dummy_image_for_outputs = gr.Image(visible=False, label='Result')
1309
+
1310
+
1311
+ with gr.Column():
1312
+ result_gallery = gr.Gallery(height=832, object_fit='contain', label='Outputs')
1313
+
1314
+ with gr.row():
1315
+ with gr.Group():
1316
+ prompt = gr.Textbox(label="Prompt")
1317
+ bg_source = gr.Radio(choices=[e.value for e in list(BGSource)[2:]],
1318
+ value=BGSource.LEFT.value,
1319
+ label="Lighting Preference (Initial Latent)", type='value')
1320
+
1321
+ example_quick_subjects = gr.Dataset(samples=quick_subjects, label='Subject Quick List', samples_per_page=1000, components=[prompt])
1322
+ example_quick_prompts = gr.Dataset(samples=quick_prompts, label='Lighting Quick List', samples_per_page=1000, components=[prompt])
1323
+ with gr.row():
1324
+ relight_button = gr.Button(value="Relight")
1325
 
1326
  with gr.Group(visible=False):
1327
  with gr.Row():
 
1332
  image_width = gr.Slider(label="Image Width", minimum=256, maximum=1024, value=512, step=64)
1333
  image_height = gr.Slider(label="Image Height", minimum=256, maximum=1024, value=640, step=64)
1334
 
1335
+ with gr.Accordion("Advanced options", open=False):
1336
+ steps = gr.Slider(label="Steps", minimum=1, maximum=100, value=15, step=1)
1337
+ cfg = gr.Slider(label="CFG Scale", minimum=1.0, maximum=32.0, value=2, step=0.01, visible=False)
1338
+ lowres_denoise = gr.Slider(label="Lowres Denoise (for initial latent)", minimum=0.1, maximum=1.0, value=0.9, step=0.01)
1339
+ highres_scale = gr.Slider(label="Highres Scale", minimum=1.0, maximum=3.0, value=1.5, step=0.01)
1340
+ highres_denoise = gr.Slider(label="Highres Denoise", minimum=0.1, maximum=1.0, value=0.5, step=0.01)
1341
+ a_prompt = gr.Textbox(label="Added Prompt", value='best quality', visible=False)
1342
+ n_prompt = gr.Textbox(label="Negative Prompt", value='lowres, bad anatomy, bad hands, cropped, worst quality', visible=False)
1343
+ x_slider = gr.Slider(
1344
+ minimum=0,
1345
+ maximum=1000,
1346
+ label="X Position",
1347
+ value=500,
1348
+ visible=False
1349
+ )
1350
+ y_slider = gr.Slider(
1351
+ minimum=0,
1352
+ maximum=1000,
1353
+ label="Y Position",
1354
+ value=500,
1355
+ visible=False
1356
+ )
1357
+
1358
+ # with gr.Row():
1359
+
 
1360
  # gr.Examples(
1361
  # fn=lambda *args: ([args[-1]], None),
1362
  # examples=db_examples.foreground_conditioned_examples,