syedfaisalabrar commited on
Commit
1e12937
·
verified ·
1 Parent(s): ce943c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -64,7 +64,7 @@ def detect_document(image):
64
 
65
  return Image.fromarray(image), labels, bounding_boxes
66
 
67
- # ---------------- Cropping Function ---------------- #
68
  def crop_image(image, bounding_boxes):
69
  """Crops detected bounding boxes from the image."""
70
  cropped_images = {}
@@ -76,7 +76,7 @@ def crop_image(image, bounding_boxes):
76
 
77
  return cropped_images
78
 
79
- # ---------------- Vision AI API Call (Dummy) ---------------- #
80
  def vision_ai_api(image, doc_type):
81
  """Dummy API call for Vision AI, returns a fake JSON response."""
82
  return {
@@ -85,7 +85,7 @@ def vision_ai_api(image, doc_type):
85
  "confidence": 0.99
86
  }
87
 
88
- # ---------------- Prediction Function ---------------- #
89
  def predict(image):
90
  """Pipeline: Preprocess -> Detect -> Crop -> Vision AI API."""
91
  processed_image = preprocessing(image)
@@ -109,7 +109,7 @@ def predict(image):
109
  single_image = cropped_images.get("front") or cropped_images.get("back") or detected_image
110
  return single_image, labels, api_results
111
 
112
- # ---------------- Gradio Interface ---------------- #
113
  iface = gr.Interface(
114
  fn=predict,
115
  inputs="image",
 
64
 
65
  return Image.fromarray(image), labels, bounding_boxes
66
 
67
+
68
  def crop_image(image, bounding_boxes):
69
  """Crops detected bounding boxes from the image."""
70
  cropped_images = {}
 
76
 
77
  return cropped_images
78
 
79
+
80
  def vision_ai_api(image, doc_type):
81
  """Dummy API call for Vision AI, returns a fake JSON response."""
82
  return {
 
85
  "confidence": 0.99
86
  }
87
 
88
+
89
  def predict(image):
90
  """Pipeline: Preprocess -> Detect -> Crop -> Vision AI API."""
91
  processed_image = preprocessing(image)
 
109
  single_image = cropped_images.get("front") or cropped_images.get("back") or detected_image
110
  return single_image, labels, api_results
111
 
112
+
113
  iface = gr.Interface(
114
  fn=predict,
115
  inputs="image",