rockerritesh commited on
Commit
d6dda21
·
verified ·
1 Parent(s): 5a6c7d5

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -0
main.py CHANGED
@@ -76,6 +76,7 @@ import gc
76
  import logging
77
  from typing import List
78
  import time
 
79
 
80
  # Configure logging
81
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
@@ -219,9 +220,17 @@ async def batch_extract_text(batch_size:int, background_tasks: BackgroundTasks,
219
  logger.error(f"Error in batch processing: {str(e)}")
220
  return {"error": str(e)}
221
 
 
222
  # Health check endpoint
223
  @app.get("/health")
224
  async def health_check():
 
 
 
 
 
 
 
225
  return {"status": "healthy"}
226
 
227
  # if __name__ == "__main__":
 
76
  import logging
77
  from typing import List
78
  import time
79
+ import numpy as np
80
 
81
  # Configure logging
82
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
 
220
  logger.error(f"Error in batch processing: {str(e)}")
221
  return {"error": str(e)}
222
 
223
+
224
  # Health check endpoint
225
  @app.get("/health")
226
  async def health_check():
227
+ # Generate a random image (20x40 pixels) with random RGB values
228
+ random_data = np.random.randint(0, 256, (20, 40, 3), dtype=np.uint8)
229
+
230
+ # Create an image from the random data
231
+ image = Image.fromarray(random_data)
232
+ predict(image)
233
+ clean_memory()
234
  return {"status": "healthy"}
235
 
236
  # if __name__ == "__main__":