Views
No views yet
1import tensorflow as tf
2from PIL import Image
3import numpy as np
4
5# Load the model
6model = tf.keras.models.load_model("https://huggingface.co/your-username/ecg_model/resolve/main/model.keras")
7
8# Preprocess input image
9def preprocess_image(image_path):
10 img = Image.open(image_path).convert("RGB").resize((224, 224))
11 img = np.array(img) / 255.0
12 return np.expand_dims(img, axis=0)
13
14# Make a prediction
15image_path = "path/to/your/image.jpg"
16input_image = preprocess_image(image_path)
17prediction = model.predict(input_image)
18
19print("Prediction:", prediction)