jbilcke-hf commited on
Commit
58240d2
·
verified ·
1 Parent(s): b0d0b61

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -475,8 +475,12 @@ def concatenate_images_vertical(image1, image2):
475
  mask_source_draw = "draw a mask on input image"
476
  mask_source_segment = "type what to detect below"
477
 
478
- def run_anything_task(input_image, text_prompt, box_threshold, text_threshold,
479
  iou_threshold, cleaner_size_limit=1080):
 
 
 
 
480
  task_type = "segment"
481
 
482
  text_prompt = text_prompt.strip()
@@ -620,7 +624,8 @@ if __name__ == "__main__":
620
  </div>""")
621
  with gr.Row():
622
  with gr.Column():
623
- text_prompt = gr.Textbox()
 
624
 
625
  input_image = gr.Image(source='upload', elem_id="image_upload", tool='sketch', type='pil', label="Upload")
626
 
 
475
  mask_source_draw = "draw a mask on input image"
476
  mask_source_segment = "type what to detect below"
477
 
478
+ def run_anything_task(secret_token, input_image, text_prompt, box_threshold, text_threshold,
479
  iou_threshold, cleaner_size_limit=1080):
480
+ if secret_token != SECRET_TOKEN:
481
+ raise gr.Error(
482
+ f'Invalid secret token. Please fork the original space if you want to use it for yourself.')
483
+
484
  task_type = "segment"
485
 
486
  text_prompt = text_prompt.strip()
 
624
  </div>""")
625
  with gr.Row():
626
  with gr.Column():
627
+ secret_token = gr.Textbox()
628
+ text_prompt = gr.Textbox()
629
 
630
  input_image = gr.Image(source='upload', elem_id="image_upload", tool='sketch', type='pil', label="Upload")
631