ysmao commited on
Commit
c515dbd
1 Parent(s): 1ed3a3a

fix gradio

Browse files
Files changed (2) hide show
  1. app.py +8 -6
  2. requirements.txt +0 -4
app.py CHANGED
@@ -73,8 +73,8 @@ def generate(
73
  num_inference_steps=steps,
74
  image=control_image,
75
  generator=generator,
76
- guidance_scale=guidance_scale,
77
- controlnet_conditioning_scale=strength,
78
  ).images
79
  return images
80
 
@@ -84,11 +84,11 @@ with block:
84
  with gr.Row():
85
  gr.Markdown("## KuJiaLe Layout ControlNet Demo")
86
  with gr.Row():
87
- input_image = gr.Image(source="upload", type="numpy", label="input_image")
88
  with gr.Row():
89
  prompt = gr.Textbox(label="Prompt")
90
  with gr.Row():
91
- run_button = gr.Button(label="Run")
92
  with gr.Row():
93
  with gr.Column():
94
  with gr.Accordion("Advanced options", open=False):
@@ -106,7 +106,7 @@ with block:
106
  label="Control Strength",
107
  minimum=0.0,
108
  maximum=2.0,
109
- value=1,
110
  step=0.1,
111
  )
112
  steps = gr.Slider(
@@ -133,7 +133,7 @@ with block:
133
  with gr.Row():
134
  image_gallery = gr.Gallery(
135
  label="Output", show_label=False, elem_id="gallery"
136
- ).style(grid=1, height="auto")
137
 
138
  ips = [
139
  input_image,
@@ -148,3 +148,5 @@ with block:
148
  seed,
149
  ]
150
  run_button.click(fn=generate, inputs=ips, outputs=[image_gallery])
 
 
 
73
  num_inference_steps=steps,
74
  image=control_image,
75
  generator=generator,
76
+ guidance_scale=float(guidance_scale),
77
+ controlnet_conditioning_scale=float(strength),
78
  ).images
79
  return images
80
 
 
84
  with gr.Row():
85
  gr.Markdown("## KuJiaLe Layout ControlNet Demo")
86
  with gr.Row():
87
+ input_image = gr.Image(type="numpy", label="input_image")
88
  with gr.Row():
89
  prompt = gr.Textbox(label="Prompt")
90
  with gr.Row():
91
+ run_button = gr.Button(value="Run")
92
  with gr.Row():
93
  with gr.Column():
94
  with gr.Accordion("Advanced options", open=False):
 
106
  label="Control Strength",
107
  minimum=0.0,
108
  maximum=2.0,
109
+ value=1.0,
110
  step=0.1,
111
  )
112
  steps = gr.Slider(
 
133
  with gr.Row():
134
  image_gallery = gr.Gallery(
135
  label="Output", show_label=False, elem_id="gallery"
136
+ )
137
 
138
  ips = [
139
  input_image,
 
148
  seed,
149
  ]
150
  run_button.click(fn=generate, inputs=ips, outputs=[image_gallery])
151
+
152
+ block.launch(server_name='0.0.0.0')
requirements.txt CHANGED
@@ -1,8 +1,4 @@
1
- --extra-index-url https://download.pytorch.org/whl/cu121
2
- torch==2.1.0
3
  torchvision
4
- torchaudio
5
-
6
  transformers
7
  diffusers
8
  opencv-python-headless
 
 
 
1
  torchvision
 
 
2
  transformers
3
  diffusers
4
  opencv-python-headless