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
Download app/core/config.py from MegrurNiftiyev/MyGuard-Prompt-Injection-Detector: direct link, hf CLI and curl.
- Browser
- Download file 2.79 kB
-
https://huggingface.co/MegrurNiftiyev/MyGuard-Prompt-Injection-Detector/resolve/main/app/core/config.py
- Command line
-
hf download hf://MegrurNiftiyev/MyGuard-Prompt-Injection-Detector/app/core/config.py
-
curl -L -o config.py https://huggingface.co/MegrurNiftiyev/MyGuard-Prompt-Injection-Detector/resolve/main/app/core/config.py
2.79 kB
| """ | |
| Application settings loaded from environment variables. | |
| """ | |
| from pydantic_settings import BaseSettings | |
| from pydantic import Field | |
| class Settings(BaseSettings): | |
| """Service configuration — all values come from env vars or .env file.""" | |
| # Service-to-service auth | |
| INTERNAL_SERVICE_TOKEN: str = Field( | |
| ..., | |
| description="Shared secret the Node.js backend sends in X-Internal-Token header", | |
| ) | |
| # Logging & Server | |
| LOG_LEVEL: str = Field(default="INFO", description="Log output level") | |
| HOST: str = Field(default="0.0.0.0", description="Bind host") | |
| PORT: int = Field(default=8000, description="Bind port") | |
| # ML Configuration | |
| ALLOW_DUMMY_MODEL_FALLBACK: bool = Field( | |
| default=False, | |
| description="Allow falling back to DummyModel if Firebase fails. Warning: DO NOT USE IN PROD", | |
| ) | |
| # CORS / Origin Security | |
| ALLOWED_ORIGINS: str = Field( | |
| default="https://mygurad-backend-v2.onrender.com,http://localhost:8000,http://127.0.0.1:8000", | |
| description="Comma-separated allowed origins", | |
| ) | |
| # Supabase Data Pipeline Configuration | |
| SUPABASE_URL: str = Field(default="", description="Supabase project URL") | |
| SUPABASE_SERVICE_ROLE_KEY: str = Field(default="", description="Supabase service role key") | |
| SUPABASE_ANON_KEY: str = Field(default="", description="Supabase public anon key") | |
| SUPABASE_STORAGE_BUCKET: str = Field(default="team-files", description="Supabase storage bucket name") | |
| DATASET_BASE_DIR: str = Field(default="./data/raw", description="Local dataset target directory") | |
| # Firebase Admin SDK Configuration | |
| FIREBASE_CREDENTIALS_PATH: str = Field( | |
| default="./mygurad-firebase-admin.json", | |
| description="Path to Firebase Admin SDK JSON key file", | |
| ) | |
| FIREBASE_CREDENTIALS_JSON: str = Field( | |
| default="", | |
| description="Raw JSON string of Firebase service account key (useful for cloud envs)", | |
| ) | |
| FIREBASE_STORAGE_BUCKET: str = Field( | |
| default="", | |
| description="Firebase Storage bucket name (e.g. myguard-project.appspot.com)", | |
| ) | |
| def SUPABASE_KEY(self) -> str: | |
| """Return SERVICE_ROLE_KEY if set, otherwise ANON_KEY.""" | |
| return self.SUPABASE_SERVICE_ROLE_KEY or self.SUPABASE_ANON_KEY | |
| def ALLOWED_ORIGINS_LIST(self) -> list[str]: | |
| """Parsed list of allowed CORS origins.""" | |
| if not self.ALLOWED_ORIGINS: | |
| return ["*"] | |
| return [o.strip() for o in self.ALLOWED_ORIGINS.split(",") if o.strip()] | |
| model_config = { | |
| "env_file": ".env", | |
| "env_file_encoding": "utf-8", | |
| "extra": "ignore", | |
| } | |
| settings = Settings() | |