JunchuanYu commited on
Commit
8a15ce4
·
1 Parent(s): ba03bf3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -18,8 +18,6 @@ loc =hf_hub_download(repo_id="JunchuanYu/files_for_segmentRS", filename="utils.p
18
  sys.path.append(loc)
19
  from utils import *
20
 
21
- predictor,sam=prediction(model_type='vit_b')
22
-
23
  with gr.Blocks(theme='gradio/soft') as demo:
24
  gr.Markdown(title)
25
  with gr.Accordion("Instructions For User 👉", open=False):
@@ -58,11 +56,12 @@ with gr.Blocks(theme='gradio/soft') as demo:
58
  outputs=[output_img],
59
  cache_examples=False,examples_per_page=5)
60
 
 
61
  autoseg_button = gr.Button("Auto Segment",variant="primary")
62
  emptyBtn = gr.Button("Restart",variant="secondary")
63
 
64
- interseg_button.click(interactive_seg, inputs=[predictor,input_img,x,y,label], outputs=[output_img,mask_img])
65
- autoseg_button.click(auto_seg, inputs=[sam,input_img,thresh,points], outputs=[mask_img])
66
 
67
  clear_bn.click(clear_point,outputs=[gallery,mode,x,y,label],show_progress=True)
68
  emptyBtn.click(reset_state,outputs=[input_img,gallery,output_img,mask_img,thresh,points,mode,x,y,label],show_progress=True,)
 
18
  sys.path.append(loc)
19
  from utils import *
20
 
 
 
21
  with gr.Blocks(theme='gradio/soft') as demo:
22
  gr.Markdown(title)
23
  with gr.Accordion("Instructions For User 👉", open=False):
 
56
  outputs=[output_img],
57
  cache_examples=False,examples_per_page=5)
58
 
59
+ model_type='vit_b'
60
  autoseg_button = gr.Button("Auto Segment",variant="primary")
61
  emptyBtn = gr.Button("Restart",variant="secondary")
62
 
63
+ interseg_button.click(interactive_seg, inputs=[input_img,x,y,label,model_type], outputs=[output_img,mask_img])
64
+ autoseg_button.click(auto_seg, inputs=[input_img,thresh,points], outputs=[mask_img])
65
 
66
  clear_bn.click(clear_point,outputs=[gallery,mode,x,y,label],show_progress=True)
67
  emptyBtn.click(reset_state,outputs=[input_img,gallery,output_img,mask_img,thresh,points,mode,x,y,label],show_progress=True,)