wealthcoders commited on
Commit
47a7709
·
verified ·
1 Parent(s): f998089

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +6 -8
handler.py CHANGED
@@ -79,7 +79,6 @@ class EndpointHandler:
79
  print(f"Image saved to: {image_path}")
80
 
81
  # Verify the image can be opened
82
- output_file = os.path.join(temp_dir, "output-1.md")
83
  try:
84
  test_image = Image.open(image_path)
85
  if test_image.mode != 'RGB':
@@ -94,17 +93,16 @@ class EndpointHandler:
94
  self.tokenizer,
95
  prompt=prompt,
96
  image_file=image_path, # Pass the PIL Image object directly
97
- output_path=output_file,
98
  base_size=1024,
99
  image_size=640,
100
  crop_mode=True,
101
- save_results=True
 
102
  )
103
-
104
- if os.path.exists(output_file):
105
- with open(output_file, 'r', encoding='utf-8') as f:
106
- content = f.read()
107
- return content
108
 
109
  except Exception as e:
110
  print(f"Error processing image: {e}")
 
79
  print(f"Image saved to: {image_path}")
80
 
81
  # Verify the image can be opened
 
82
  try:
83
  test_image = Image.open(image_path)
84
  if test_image.mode != 'RGB':
 
93
  self.tokenizer,
94
  prompt=prompt,
95
  image_file=image_path, # Pass the PIL Image object directly
96
+ output_path=temp_dir,
97
  base_size=1024,
98
  image_size=640,
99
  crop_mode=True,
100
+ save_results=False,
101
+ eval_mode=True
102
  )
103
+
104
+ print(str(result))
105
+ return result
 
 
106
 
107
  except Exception as e:
108
  print(f"Error processing image: {e}")