ameerazam08 commited on
Commit
82af7c3
1 Parent(s): 20e9cf6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -4,6 +4,7 @@
4
  # @Author : ashui(Binghui Chen)
5
  from sympy import im
6
  import time
 
7
  import cv2
8
  import gradio as gr
9
  import numpy as np
@@ -52,7 +53,8 @@ showcases = []
52
  for idx, name in enumerate(files):
53
  temp = os.path.join(os.path.dirname(__file__), img, name)
54
  showcases.append(temp)
55
-
 
56
  def process(original_image, original_mask, input_mask, selected_points, prompt,negative_prompt,guidance_scale,steps,strength,scheduler):
57
  if original_image.shape[0]>original_image.shape[1]:
58
  original_image=cv2.resize(original_image,(int(original_image.shape[1]*1000/original_image.shape[0]),1000))
@@ -126,7 +128,7 @@ block = gr.Blocks(
126
  radius_size=gr.themes.sizes.radius_none,
127
  text_size=gr.themes.sizes.text_md
128
  )
129
- ).queue(concurrency_count=2)
130
  with block:
131
  with gr.Row():
132
  with gr.Column():
@@ -307,5 +309,5 @@ with block:
307
  ips=[original_image, original_mask, input_mask, selected_points, prompt,negative_prompt,guidance_scale,steps,strength,scheduler]
308
  run_button.click(fn=process, inputs=ips, outputs=[result_gallery, request_id, gallery_flag])
309
 
310
-
311
  block.launch()
 
 
4
  # @Author : ashui(Binghui Chen)
5
  from sympy import im
6
  import time
7
+ import spaces
8
  import cv2
9
  import gradio as gr
10
  import numpy as np
 
53
  for idx, name in enumerate(files):
54
  temp = os.path.join(os.path.dirname(__file__), img, name)
55
  showcases.append(temp)
56
+
57
+ @spaces.GPU(enable_queue=True)
58
  def process(original_image, original_mask, input_mask, selected_points, prompt,negative_prompt,guidance_scale,steps,strength,scheduler):
59
  if original_image.shape[0]>original_image.shape[1]:
60
  original_image=cv2.resize(original_image,(int(original_image.shape[1]*1000/original_image.shape[0]),1000))
 
128
  radius_size=gr.themes.sizes.radius_none,
129
  text_size=gr.themes.sizes.text_md
130
  )
131
+ ).queue(concurrency_count=2,max_size=4)
132
  with block:
133
  with gr.Row():
134
  with gr.Column():
 
309
  ips=[original_image, original_mask, input_mask, selected_points, prompt,negative_prompt,guidance_scale,steps,strength,scheduler]
310
  run_button.click(fn=process, inputs=ips, outputs=[result_gallery, request_id, gallery_flag])
311
 
 
312
  block.launch()
313
+