tombetthauser commited on
Commit
f839db8
β€’
1 Parent(s): bc0eff1

Revert to gradio 2 code and lock in requirements

Browse files
Files changed (1) hide show
  1. app.py +26 -36
app.py CHANGED
@@ -349,23 +349,18 @@ with gr.Blocks(css=".gradio-container {max-width: 650px}") as advanced_tab:
349
  with gr.Row():
350
  prompt = gr.Textbox(label="image prompt...", elem_id="input-text")
351
  with gr.Row():
352
- # seed = gr.Slider(0, 99999999999999, label="seed", dtype=int, value=random_seed, interactive=True, step=1)
353
- seed = gr.Slider(0, 99999999999999, label="seed", value=random_seed, interactive=True, step=1)
354
  negative_prompt = gr.Textbox(label="negative prompt (optional)", elem_id="input-text")
355
  with gr.Row():
356
  with gr.Column():
357
- # guidance = gr.Slider(0, 10, label="guidance", dtype=float, value=default_guidance, step=0.1, interactive=True)
358
- guidance = gr.Slider(0, 10, label="guidance", value=default_guidance, step=0.1, interactive=True)
359
  with gr.Column():
360
- # steps = gr.Slider(1, 100, label="inference steps", dtype=int, value=default_steps, step=1, interactive=True)
361
- steps = gr.Slider(1, 100, label="inference steps", value=default_steps, step=1, interactive=True)
362
  with gr.Row():
363
  with gr.Column():
364
- # width = gr.Slider(144, 4200, label="width", dtype=int, value=default_pixel, step=8, interactive=True)
365
- width = gr.Slider(144, 4200, label="width", value=default_pixel, step=8, interactive=True)
366
  with gr.Column():
367
- # height = gr.Slider(144, 4200, label="height", dtype=int, value=default_pixel, step=8, interactive=True)
368
- height = gr.Slider(144, 4200, label="height", value=default_pixel, step=8, interactive=True)
369
  gr.Markdown("<u>heads-up</u>: Height multiplied by width should not exceed about 645,000 or an error may occur. If an error occours refresh your browser tab or errors will continue. If you exceed this range the app will attempt to avoid an error by lowering your input height. We are actively seeking out ways to handle higher resolutions!")
370
 
371
  go_button = gr.Button("generate image", elem_id="go-button")
@@ -578,11 +573,10 @@ def canny_process_image(input_image, input_low_threshold, input_high_threshold,
578
  return np.array(canny_2)
579
 
580
  # Define the input and output interfaces
581
- # canny_input_image = gr.Image()
582
- canny_input_image = gr.Image()
583
- canny_input_low_threshold = gr.Slider(minimum=0, maximum=1000, step=1, label="Lower Threshold:", default=100)
584
- canny_input_high_threshold = gr.Slider(minimum=0, maximum=1000, step=1, label="Upper Threshold:", default=200)
585
- canny_input_invert = gr.Checkbox(label="Invert Image")
586
 
587
  canny_outputs = gr.outputs.Image(type="numpy")
588
 
@@ -707,18 +701,16 @@ with gr.Blocks() as canny_blocks_interface:
707
  ''')
708
  with gr.Row():
709
  with gr.Column():
710
- canny_input_prompt = gr.Textbox(label="enter your text prompt here")
711
  with gr.Accordion(label='negative prompt (optional)', open=False):
712
- canny_negative_prompt = gr.Textbox()
713
- canny_input_low_threshold = gr.Slider(minimum=0, maximum=1000, step=1, label="Lower Threshold:", default=100)
714
- canny_input_high_threshold = gr.Slider(minimum=0, maximum=1000, step=1, label="Upper Threshold:", default=120)
715
- # canny_input_seed = gr.Slider(0, 99999999999999, label="seed", dtype=int, value=random_seed, interactive=True, step=1)
716
- canny_input_seed = gr.Slider(0, 99999999999999, label="seed", value=random_seed, interactive=True, step=1)
717
- canny_input_invert = gr.Checkbox(label="invert edge tracing image")
718
  canny_input_rotate = gr.Dropdown([0, 90, 180, 270], label="rotate image (for smartphones)")
719
  with gr.Column():
720
- # canny_input_image = gr.Image(label="input image")
721
- canny_input_image = gr.Image(label="input image")
722
  go_button = gr.Button('generate image')
723
  # with gr.Row():
724
  with gr.Accordion(label='traced edge image', open=False):
@@ -792,11 +784,11 @@ with gr.Blocks() as canny_blocks_interface:
792
  # return output_image[0][0]
793
 
794
 
795
- # canny_input_prompt = gr.Textbox(label="Enter a single word or phrase")
796
- # canny_input_image = gr.Image()
797
- # canny_input_low_threshold = gr.Slider(minimum=0, maximum=1000, step=1, label="Lower Threshold:", default=100)
798
- # canny_input_high_threshold = gr.Slider(minimum=0, maximum=1000, step=1, label="Upper Threshold:", default=200)
799
- # canny_input_invert = gr.Checkbox(label="Invert Image")
800
  # canny_outputs = gr.outputs.Image(type="pil")
801
 
802
  # make and launch the gradio app...
@@ -932,21 +924,19 @@ with gr.Blocks() as depth_controlnet_gradio:
932
  gr.Markdown('''
933
  ## Inputs...
934
  ''')
935
- input_prompt = gr.Textbox(label="text prompt")
936
- # input_image = gr.Image(label="input image")
937
- input_image = gr.Image(label="input image")
938
  with gr.Accordion(label="options", open=False):
939
  with gr.Row():
940
  with gr.Column():
941
- input_negative_prompt = gr.Textbox(label="negative prompt")
942
  with gr.Column():
943
- # input_seed = gr.Slider(0, 99999999999999, label="seed", dtype=int, value=random_seed, interactive=True, step=1)
944
- input_seed = gr.Slider(0, 99999999999999, label="seed", value=random_seed, interactive=True, step=1)
945
  with gr.Row():
946
  with gr.Column():
947
  input_rotate = gr.Dropdown([0, 90, 180, 270], label="rotate image (for smartphones)")
948
  with gr.Column():
949
- input_invert = gr.Checkbox(label="invert depthmap")
950
  submit = gr.Button('generate image')
951
 
952
  with gr.Column():
 
349
  with gr.Row():
350
  prompt = gr.Textbox(label="image prompt...", elem_id="input-text")
351
  with gr.Row():
352
+ seed = gr.Slider(0, 99999999999999, label="seed", dtype=int, value=random_seed, interactive=True, step=1)
 
353
  negative_prompt = gr.Textbox(label="negative prompt (optional)", elem_id="input-text")
354
  with gr.Row():
355
  with gr.Column():
356
+ guidance = gr.Slider(0, 10, label="guidance", dtype=float, value=default_guidance, step=0.1, interactive=True)
 
357
  with gr.Column():
358
+ steps = gr.Slider(1, 100, label="inference steps", dtype=int, value=default_steps, step=1, interactive=True)
 
359
  with gr.Row():
360
  with gr.Column():
361
+ width = gr.Slider(144, 4200, label="width", dtype=int, value=default_pixel, step=8, interactive=True)
 
362
  with gr.Column():
363
+ height = gr.Slider(144, 4200, label="height", dtype=int, value=default_pixel, step=8, interactive=True)
 
364
  gr.Markdown("<u>heads-up</u>: Height multiplied by width should not exceed about 645,000 or an error may occur. If an error occours refresh your browser tab or errors will continue. If you exceed this range the app will attempt to avoid an error by lowering your input height. We are actively seeking out ways to handle higher resolutions!")
365
 
366
  go_button = gr.Button("generate image", elem_id="go-button")
 
573
  return np.array(canny_2)
574
 
575
  # Define the input and output interfaces
576
+ canny_input_image = gr.inputs.Image()
577
+ canny_input_low_threshold = gr.inputs.Slider(minimum=0, maximum=1000, step=1, label="Lower Threshold:", default=100)
578
+ canny_input_high_threshold = gr.inputs.Slider(minimum=0, maximum=1000, step=1, label="Upper Threshold:", default=200)
579
+ canny_input_invert = gr.inputs.Checkbox(label="Invert Image")
 
580
 
581
  canny_outputs = gr.outputs.Image(type="numpy")
582
 
 
701
  ''')
702
  with gr.Row():
703
  with gr.Column():
704
+ canny_input_prompt = gr.inputs.Textbox(label="enter your text prompt here")
705
  with gr.Accordion(label='negative prompt (optional)', open=False):
706
+ canny_negative_prompt = gr.inputs.Textbox()
707
+ canny_input_low_threshold = gr.inputs.Slider(minimum=0, maximum=1000, step=1, label="Lower Threshold:", default=100)
708
+ canny_input_high_threshold = gr.inputs.Slider(minimum=0, maximum=1000, step=1, label="Upper Threshold:", default=120)
709
+ canny_input_seed = gr.Slider(0, 99999999999999, label="seed", dtype=int, value=random_seed, interactive=True, step=1)
710
+ canny_input_invert = gr.inputs.Checkbox(label="invert edge tracing image")
 
711
  canny_input_rotate = gr.Dropdown([0, 90, 180, 270], label="rotate image (for smartphones)")
712
  with gr.Column():
713
+ canny_input_image = gr.inputs.Image(label="input image")
 
714
  go_button = gr.Button('generate image')
715
  # with gr.Row():
716
  with gr.Accordion(label='traced edge image', open=False):
 
784
  # return output_image[0][0]
785
 
786
 
787
+ # canny_input_prompt = gr.inputs.Textbox(label="Enter a single word or phrase")
788
+ # canny_input_image = gr.inputs.Image()
789
+ # canny_input_low_threshold = gr.inputs.Slider(minimum=0, maximum=1000, step=1, label="Lower Threshold:", default=100)
790
+ # canny_input_high_threshold = gr.inputs.Slider(minimum=0, maximum=1000, step=1, label="Upper Threshold:", default=200)
791
+ # canny_input_invert = gr.inputs.Checkbox(label="Invert Image")
792
  # canny_outputs = gr.outputs.Image(type="pil")
793
 
794
  # make and launch the gradio app...
 
924
  gr.Markdown('''
925
  ## Inputs...
926
  ''')
927
+ input_prompt = gr.inputs.Textbox(label="text prompt")
928
+ input_image = gr.inputs.Image(label="input image")
 
929
  with gr.Accordion(label="options", open=False):
930
  with gr.Row():
931
  with gr.Column():
932
+ input_negative_prompt = gr.inputs.Textbox(label="negative prompt")
933
  with gr.Column():
934
+ input_seed = gr.Slider(0, 99999999999999, label="seed", dtype=int, value=random_seed, interactive=True, step=1)
 
935
  with gr.Row():
936
  with gr.Column():
937
  input_rotate = gr.Dropdown([0, 90, 180, 270], label="rotate image (for smartphones)")
938
  with gr.Column():
939
+ input_invert = gr.inputs.Checkbox(label="invert depthmap")
940
  submit = gr.Button('generate image')
941
 
942
  with gr.Column():