Spaces:
Sleeping
Sleeping
fix cpu
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ def load_model(model_path, device='cpu'):
|
|
| 32 |
return model.to(device)
|
| 33 |
|
| 34 |
# Get prediction
|
| 35 |
-
def get_prediction(model, padded_sequences, img_x, device='
|
| 36 |
malware_classes = ["Benign", "RedLine Stealer", "Downloader", "RAT",
|
| 37 |
"Banking Trojan", "Snake Keylogger", "Spyware"]
|
| 38 |
|
|
@@ -61,10 +61,10 @@ def predict_malware(sha256_hash):
|
|
| 61 |
|
| 62 |
# Load the model
|
| 63 |
model_path = "model_dump/model_malware_lstm (1).pkl"
|
| 64 |
-
model = load_model(model_path, device=
|
| 65 |
|
| 66 |
# Get the prediction
|
| 67 |
-
predicted_class = get_prediction(model, padded_sequences, img_x,
|
| 68 |
|
| 69 |
# Load the image for display
|
| 70 |
img_x_display = Image.open(image_path)
|
|
|
|
| 32 |
return model.to(device)
|
| 33 |
|
| 34 |
# Get prediction
|
| 35 |
+
def get_prediction(model, padded_sequences, img_x, device='cpu'):
|
| 36 |
malware_classes = ["Benign", "RedLine Stealer", "Downloader", "RAT",
|
| 37 |
"Banking Trojan", "Snake Keylogger", "Spyware"]
|
| 38 |
|
|
|
|
| 61 |
|
| 62 |
# Load the model
|
| 63 |
model_path = "model_dump/model_malware_lstm (1).pkl"
|
| 64 |
+
model = load_model(model_path, device='cpu')
|
| 65 |
|
| 66 |
# Get the prediction
|
| 67 |
+
predicted_class = get_prediction(model, padded_sequences, img_x, 'cpu')
|
| 68 |
|
| 69 |
# Load the image for display
|
| 70 |
img_x_display = Image.open(image_path)
|