nsfwalex commited on
Commit
0be860d
โ€ข
1 Parent(s): a402a67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -26,7 +26,7 @@ def deep_nude_process(inputpath):
26
  watermark = cv2.resize(watermark, (w, h), interpolation=cv2.INTER_CUBIC)
27
  return watermark
28
 
29
- def inference(img):
30
  global index
31
  bgra = cv2.cvtColor(img, cv2.COLOR_RGBA2BGRA)
32
  inputpath = f"input_{index}.jpg"
@@ -172,7 +172,7 @@ function uploadImage(image, event, source, value) {
172
  window.cur_process_step = "";
173
  console.log("uploadImage", image ? image.url : null, event, source, value);
174
  // Get the first image from the gallery (assuming it's an array)
175
- let imageUrl = images && images.length > 0 ? images[0].image.url : null;
176
  if (window.self !== window.top) {
177
  // Post the message to the parent window
178
  // Prepare the data to send
@@ -204,8 +204,7 @@ function onDemoLoad(){
204
  element.parentNode.removeChild(element);
205
  }
206
  }
207
- return;
208
- //return envInfo["__domain"], envInfo["__iframe_domain"]
209
  }
210
  </script>
211
  '''
@@ -224,9 +223,9 @@ with gr.Blocks(css=css, head=js) as demo:
224
  with gr.Row(equal_height=False):
225
  with gr.Column(min_width=240): # Adjust scale for proper sizing
226
  gr.HTML(value=desc_html, elem_id='pitch_desc_html_code')
227
- image_input = gr.Image(type="numpy", label="Upload Image", height=height)
228
  gr.Examples(examples=examples, inputs=image_input, examples_per_page=10, elem_id="example_img")
229
- process_button = gr.Button("Go!")#,size="sm"
230
 
231
 
232
 
 
26
  watermark = cv2.resize(watermark, (w, h), interpolation=cv2.INTER_CUBIC)
27
  return watermark
28
 
29
+ def inference(img, progress=gr.Progress(track_tqdm=True)):
30
  global index
31
  bgra = cv2.cvtColor(img, cv2.COLOR_RGBA2BGRA)
32
  inputpath = f"input_{index}.jpg"
 
172
  window.cur_process_step = "";
173
  console.log("uploadImage", image ? image.url : null, event, source, value);
174
  // Get the first image from the gallery (assuming it's an array)
175
+ let imageUrl = image ? image.url : null;
176
  if (window.self !== window.top) {
177
  // Post the message to the parent window
178
  // Prepare the data to send
 
204
  element.parentNode.removeChild(element);
205
  }
206
  }
207
+ return "";
 
208
  }
209
  </script>
210
  '''
 
223
  with gr.Row(equal_height=False):
224
  with gr.Column(min_width=240): # Adjust scale for proper sizing
225
  gr.HTML(value=desc_html, elem_id='pitch_desc_html_code')
226
+ image_input = gr.Image(type="numpy", label="", height=height)
227
  gr.Examples(examples=examples, inputs=image_input, examples_per_page=10, elem_id="example_img")
228
+ process_button = gr.Button("Nude!",size="sm")
229
 
230
 
231