pavankm96 commited on
Commit
09d2dba
·
verified ·
1 Parent(s): ad3717b

Delete pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +0 -22
pipeline.py DELETED
@@ -1,22 +0,0 @@
1
- from transformers import Pipeline
2
- import numpy as np
3
- import tensorflow as tf
4
- from PIL import Image
5
-
6
- class BrainTumorDetectionPipeline(Pipeline):
7
- def __init__(self, model_path: str, *args, **kwargs):
8
- super().__init__(*args, **kwargs)
9
- self.model = tf.keras.models.load_model(model_path)
10
-
11
- def preprocess(self, images: list):
12
- processed_images = []
13
- for image in images:
14
- image = Image.open(image).resize((128, 128)) # Resize to model input size
15
- image = np.array(image) / 255.0 # Normalize the image
16
- processed_images.append(np.expand_dims(image, axis=0)) # Add batch dimension
17
- return np.vstack(processed_images) # Stack for batch processing
18
-
19
- def forward(self, images: list):
20
- preprocessed_images = self.preprocess(images)
21
- predictions = self.model.predict(preprocessed_images)
22
- return predictions