jadechoghari commited on
Commit
bcad80e
1 Parent(s): f26ac1a

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +5 -2
inference.py CHANGED
@@ -6,7 +6,7 @@ import re
6
  import json
7
  import subprocess
8
 
9
- def process_inference_results(results):
10
  """
11
  Process the inference results by:
12
  1. Adding bounding boxes on the image based on the coordinates in 'text'.
@@ -34,7 +34,10 @@ def process_inference_results(results):
34
 
35
  processed_images.append(img)
36
 
37
- return processed_images, extracted_texts
 
 
 
38
 
39
  def inference_and_run(image_path, prompt, conv_mode="ferret_gemma_instruct", model_path="jadechoghari/Ferret-UI-Gemma2b", box=None):
40
  """
 
6
  import json
7
  import subprocess
8
 
9
+ def process_inference_results(results, process_image=False):
10
  """
11
  Process the inference results by:
12
  1. Adding bounding boxes on the image based on the coordinates in 'text'.
 
34
 
35
  processed_images.append(img)
36
 
37
+ if process_image:
38
+ return processed_images, extracted_texts
39
+
40
+ return extracted_texts
41
 
42
  def inference_and_run(image_path, prompt, conv_mode="ferret_gemma_instruct", model_path="jadechoghari/Ferret-UI-Gemma2b", box=None):
43
  """