Text Classification
Keras
English
Azerbaijani
prompt-injection
security
llm-security
document-security
retvec
cnn
tensorflow
fastapi
Eval Results (legacy)
Instructions to use MegrurNiftiyev/MyGuard-Prompt-Injection-Detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use MegrurNiftiyev/MyGuard-Prompt-Injection-Detector with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://MegrurNiftiyev/MyGuard-Prompt-Injection-Detector") - Notebooks
- Google Colab
- Kaggle
File size: 1,087 Bytes
215f97f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | """
Tests for the model registry module.
"""
import pytest
from app.ml.serving.registry import (
DummyModel,
serialize_model,
deserialize_model,
)
class TestDummyModel:
"""Verify the DummyModel stub works as expected."""
def test_predict_returns_tuple(self):
model = DummyModel()
result = model.predict("some text")
assert isinstance(result, tuple)
assert len(result) == 2
def test_predict_label(self):
model = DummyModel()
label, confidence = model.predict("anything")
assert label == "safe"
assert isinstance(confidence, float)
class TestSerialization:
"""Verify model serialize/deserialize round-trips correctly."""
def test_round_trip(self):
original = DummyModel()
blob = serialize_model(original)
assert isinstance(blob, bytes)
restored = deserialize_model(blob)
assert isinstance(restored, DummyModel)
# Verify the restored model still works
label, confidence = restored.predict("test")
assert label == "safe"
|