P3ngLiu commited on
Commit
2107a9f
·
1 Parent(s): 84e7bff
Files changed (2) hide show
  1. README.md +1 -1
  2. demo/gradio_demo.py +2 -13
README.md CHANGED
@@ -5,7 +5,7 @@ colorFrom: green
5
  colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 5.49.1
8
- app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
  short_description: VLM-FO1-3B-Demo
 
5
  colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 5.49.1
8
+ app_file: demo/gradio_demo.py
9
  pinned: false
10
  license: apache-2.0
11
  short_description: VLM-FO1-3B-Demo
demo/gradio_demo.py CHANGED
@@ -12,6 +12,7 @@ from vlm_fo1.mm_utils import (
12
  )
13
  from vlm_fo1.task_templates import *
14
  import torch
 
15
 
16
 
17
  TASK_TYPES = {
@@ -128,7 +129,7 @@ def extract_bbox_and_original_image(edited_image: dict):
128
 
129
  return original_image, bbox_list
130
 
131
-
132
  def process(image, prompt, threshold):
133
  image, bbox_list = extract_bbox_and_original_image(image)
134
  image = image.convert('RGB')
@@ -237,18 +238,6 @@ def launch_demo():
237
 
238
  return demo
239
 
240
- import subprocess
241
- import sys
242
-
243
- def run_step(description, command):
244
- """Prints description, runs command, and exits on failure."""
245
- print(f"--- {description} ---")
246
- result = subprocess.run(command, shell=True)
247
- if result.returncode != 0:
248
- print(f"{description} failed, exit.")
249
- sys.exit(1)
250
- print(f"--- {description} successfully ---")
251
-
252
  if __name__ == "__main__":
253
  model_path = 'omlab/VLM-FO1_Qwen2.5-VL-3B-v01'
254
  upn_ckpt_path = "./resources/upn_large.pth"
 
12
  )
13
  from vlm_fo1.task_templates import *
14
  import torch
15
+ import spaces
16
 
17
 
18
  TASK_TYPES = {
 
129
 
130
  return original_image, bbox_list
131
 
132
+ @spaces.GPU
133
  def process(image, prompt, threshold):
134
  image, bbox_list = extract_bbox_and_original_image(image)
135
  image = image.convert('RGB')
 
238
 
239
  return demo
240
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  if __name__ == "__main__":
242
  model_path = 'omlab/VLM-FO1_Qwen2.5-VL-3B-v01'
243
  upn_ckpt_path = "./resources/upn_large.pth"