Luis J Camargo commited on
Commit
414d76f
·
1 Parent(s): b107ea6

refactor: Update pipeline predict call to use keyword argument and iterate through results for printing.

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -183,7 +183,7 @@ def run_inference(img_path, task_type="ocr"):
183
 
184
  try:
185
  logger.info(f"--- Inference Start: {task_type} ---")
186
- output = pipeline.predict(img_path)
187
  logger.info(f"Output object type: {type(output)}")
188
  logger.info(f"Output object: {output}")
189
 
@@ -194,6 +194,11 @@ def run_inference(img_path, task_type="ocr"):
194
  run_id = f"run_{int(time.time())}"
195
  run_output_dir = os.path.join(OUTPUT_DIR, run_id)
196
  os.makedirs(run_output_dir, exist_ok=True)
 
 
 
 
 
197
 
198
  for i, res in enumerate(output):
199
  logger.info(f"Processing segment {i+1}...")
 
183
 
184
  try:
185
  logger.info(f"--- Inference Start: {task_type} ---")
186
+ output = pipeline.predict(input=img_path)
187
  logger.info(f"Output object type: {type(output)}")
188
  logger.info(f"Output object: {output}")
189
 
 
194
  run_id = f"run_{int(time.time())}"
195
  run_output_dir = os.path.join(OUTPUT_DIR, run_id)
196
  os.makedirs(run_output_dir, exist_ok=True)
197
+
198
+ logger.info(f"will iterate")
199
+ for res in output:
200
+ logger.info(f"Output object: {res}")
201
+ res.print()
202
 
203
  for i, res in enumerate(output):
204
  logger.info(f"Processing segment {i+1}...")