Views
No views yet
1from tensorflow import keras
2from huggingface_hub import hf_hub_download
3import numpy as np
4
5# Download model
6model_path = hf_hub_download("username/waferguard-cnn", filename="model.keras")
7model = keras.models.load_model(model_path)
8
9# Predict on wafer map (52, 52, 3)
10wafer_map = np.random.randint(0, 3, (1, 52, 52, 3)).astype(np.float32)
11predictions = model.predict(wafer_map)
12predicted_class = np.argmax(predictions[0])
13confidence = predictions[0, predicted_class]
14
15print(f"Class: {predicted_class}, Confidence: {confidence:.2%}")