k23064919 commited on
Commit
bcc26c6
·
1 Parent(s): fcf6bb8

remove half implemented batch processing feature

Browse files
Files changed (2) hide show
  1. ui/app.py +0 -19
  2. ui/utils.py +1 -36
ui/app.py CHANGED
@@ -222,25 +222,6 @@ def create_interface():
222
  outputs=flag_output
223
  )
224
 
225
-
226
- with gr.Tab("Batch Processing"):
227
- gr.Markdown("### Upload multiple images for batch processing")
228
-
229
- batch_input = gr.File(
230
- label="Upload Multiple Images",
231
- file_count="multiple",
232
- type="filepath"
233
- )
234
-
235
- batch_predict_btn = gr.Button("Predict All", variant="primary")
236
-
237
- batch_output = gr.Markdown(label="Batch Results")
238
-
239
- batch_predict_btn.click(
240
- # fn=app.predict_batch,
241
- inputs=[batch_input, model_selector, confidence_slider],
242
- outputs=batch_output
243
- )
244
  with gr.Tab("About"):
245
  gr.Markdown(
246
  """
 
222
  outputs=flag_output
223
  )
224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  with gr.Tab("About"):
226
  gr.Markdown(
227
  """
ui/utils.py CHANGED
@@ -97,14 +97,6 @@ def get_disease_info(class_name):
97
  }
98
 
99
 
100
- def batch_preprocess_images(images):
101
- """
102
- Preprocess a list of images into a batch tensor
103
- """
104
- tensors = [preprocess_image(img) for img in images]
105
- return torch.cat(tensors, dim=0)
106
-
107
-
108
  def create_confidence_label(predictions, top_k=5):
109
  """
110
  Render a formatted multiline prediction list
@@ -120,31 +112,4 @@ def create_confidence_label(predictions, top_k=5):
120
 
121
  def get_class_names():
122
  """Return the loaded class names from the txt file."""
123
- return CLASS_NAMES
124
-
125
- if __name__ == "__main__":
126
- print("Testing utility functions...")
127
-
128
- test_names = [
129
- "Tomato___Late_blight",
130
- "Apple___healthy",
131
- "Corn_(maize)___Common_rust_"
132
- ]
133
-
134
- print("\nClass name formatting:")
135
- for name in test_names:
136
- print(f" {name} -> {format_class_name(name)}")
137
-
138
- print("\nDisease info:")
139
- for name in test_names:
140
- info = get_disease_info(name)
141
- print(f" {name}:")
142
- print(f" Plant: {info['plant']}")
143
- print(f" Disease: {info['disease']}")
144
- print(f" Healthy: {info['is_healthy']}")
145
-
146
- print("\nImage preprocessing:")
147
- dummy_image = Image.new('RGB', (512, 512), color='red')
148
- tensor = preprocess_image(dummy_image)
149
- print(f" Input size: {dummy_image.size}")
150
- print(f" Output tensor shape: {tensor.shape}")
 
97
  }
98
 
99
 
 
 
 
 
 
 
 
 
100
  def create_confidence_label(predictions, top_k=5):
101
  """
102
  Render a formatted multiline prediction list
 
112
 
113
  def get_class_names():
114
  """Return the loaded class names from the txt file."""
115
+ return CLASS_NAMES