Spaces:
Running
Running
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,189 +1,39 @@
|
|
| 1 |
---
|
| 2 |
title: CyberForge AI
|
| 3 |
emoji: 🔐
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
-
pinned:
|
| 10 |
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
- **🤖 Multiple Security Tasks**: Malware detection, phishing detection, network intrusion, anomaly detection, and more
|
| 23 |
-
- **☁️ Cloud Training**: Leverage Hugging Face's infrastructure for training without local compute resources
|
| 24 |
-
- **🔗 API Integration**: RESTful API endpoints for backend integration
|
| 25 |
-
- **💾 Model Hub**: Upload trained models to Hugging Face Hub for sharing and deployment
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|------|-------------|
|
| 31 |
-
| Malware Detection | Identify malicious software patterns |
|
| 32 |
-
| Phishing Detection | Detect phishing URLs and emails |
|
| 33 |
-
| Network Intrusion Detection | Identify network attack patterns |
|
| 34 |
-
| Anomaly Detection | Detect unusual system behavior |
|
| 35 |
-
| Botnet Detection | Identify botnet command & control traffic |
|
| 36 |
-
| Web Attack Detection | Detect SQL injection, XSS, etc. |
|
| 37 |
-
| Spam Detection | Filter spam messages |
|
| 38 |
-
| Vulnerability Assessment | Assess system vulnerabilities |
|
| 39 |
-
| DNS Tunneling Detection | Detect DNS-based data exfiltration |
|
| 40 |
-
| Cryptomining Detection | Identify unauthorized mining activity |
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
- **Random Forest**: Robust ensemble classifier
|
| 45 |
-
- **Gradient Boosting**: High-performance gradient boosting
|
| 46 |
-
- **Logistic Regression**: Fast baseline classifier
|
| 47 |
-
- **Isolation Forest**: Unsupervised anomaly detection
|
| 48 |
-
- **Neural Networks**: Deep learning models (when available)
|
| 49 |
-
- **Ensemble Models**: Voting and stacking classifiers
|
| 50 |
-
|
| 51 |
-
## 📖 How to Use
|
| 52 |
-
|
| 53 |
-
### 1. Training a Model
|
| 54 |
-
|
| 55 |
-
1. Go to the **🎯 Train Model** tab
|
| 56 |
-
2. Upload your dataset (CSV, JSON, or Parquet)
|
| 57 |
-
3. Select the security task type
|
| 58 |
-
4. Choose a model type
|
| 59 |
-
5. Enter the target column name
|
| 60 |
-
6. Click **Train Model**
|
| 61 |
-
|
| 62 |
-
### 2. Running Inference
|
| 63 |
-
|
| 64 |
-
1. Go to the **🔮 Run Inference** tab
|
| 65 |
-
2. Enter the model ID from training
|
| 66 |
-
3. Provide input features as JSON
|
| 67 |
-
4. Click **Run Inference**
|
| 68 |
-
|
| 69 |
-
### 3. Backend Integration
|
| 70 |
-
|
| 71 |
-
```python
|
| 72 |
-
from gradio_client import Client
|
| 73 |
-
|
| 74 |
-
# Connect to the Space
|
| 75 |
-
client = Client("Che237/cyberforge")
|
| 76 |
-
|
| 77 |
-
# Train a model
|
| 78 |
-
result = client.predict(
|
| 79 |
-
file="path/to/dataset.csv",
|
| 80 |
-
task_type="Malware Detection",
|
| 81 |
-
model_type="Random Forest",
|
| 82 |
-
target_column="label",
|
| 83 |
-
test_size=0.2,
|
| 84 |
-
model_name="my_model",
|
| 85 |
-
api_name="/train_model"
|
| 86 |
-
)
|
| 87 |
-
|
| 88 |
-
# Run inference
|
| 89 |
-
predictions = client.predict(
|
| 90 |
-
model_id="my_model_malware_detection_20240101_120000",
|
| 91 |
-
input_data='[{"feature1": 0.5, "feature2": 1.2}]',
|
| 92 |
-
api_name="/run_inference"
|
| 93 |
-
)
|
| 94 |
-
```
|
| 95 |
-
|
| 96 |
-
### 4. Node.js Backend Integration
|
| 97 |
-
|
| 98 |
-
```javascript
|
| 99 |
-
const { Client } = require("@gradio/client");
|
| 100 |
-
|
| 101 |
-
async function runPrediction(modelId, features) {
|
| 102 |
-
const client = await Client.connect("Che237/cyberforge");
|
| 103 |
-
const result = await client.predict("/run_inference", {
|
| 104 |
-
model_id: modelId,
|
| 105 |
-
input_data: JSON.stringify([features])
|
| 106 |
-
});
|
| 107 |
-
return JSON.parse(result.data);
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
// Usage
|
| 111 |
-
const prediction = await runPrediction(
|
| 112 |
-
"cyberforge_model_malware_detection_20240101",
|
| 113 |
-
{ src_bytes: 1000, dst_bytes: 500, protocol_type: 0 }
|
| 114 |
-
);
|
| 115 |
-
console.log(prediction);
|
| 116 |
-
```
|
| 117 |
-
|
| 118 |
-
## 📊 Dataset Format
|
| 119 |
-
|
| 120 |
-
Your dataset should be in CSV, JSON, or Parquet format with:
|
| 121 |
-
|
| 122 |
-
- **Features**: Numerical or categorical columns
|
| 123 |
-
- **Target**: A column indicating the class/label (e.g., `label`, `is_malicious`, `attack_type`)
|
| 124 |
-
|
| 125 |
-
### Example CSV Structure:
|
| 126 |
-
|
| 127 |
-
```csv
|
| 128 |
-
src_bytes,dst_bytes,protocol_type,service,flag,label
|
| 129 |
-
1000,500,tcp,http,SF,normal
|
| 130 |
-
5000,2000,udp,dns,REJ,attack
|
| 131 |
-
...
|
| 132 |
-
```
|
| 133 |
-
|
| 134 |
-
## 🔗 API Endpoints
|
| 135 |
-
|
| 136 |
-
| Endpoint | Method | Description |
|
| 137 |
-
|----------|--------|-------------|
|
| 138 |
-
| `/train_model` | POST | Train a new model |
|
| 139 |
-
| `/run_inference` | POST | Run predictions |
|
| 140 |
-
| `/list_trained_models` | GET | List available models |
|
| 141 |
-
| `/upload_model_to_hub` | POST | Upload model to Hub |
|
| 142 |
-
| `/download_model_from_hub` | POST | Download model from Hub |
|
| 143 |
-
|
| 144 |
-
## 🏗️ Architecture
|
| 145 |
-
|
| 146 |
-
```
|
| 147 |
-
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
|
| 148 |
-
│ Your Backend │ ──▶ │ HF Space (API) │ ──▶ │ Trained Models │
|
| 149 |
-
│ (Node.js) │ ◀── │ (Gradio) │ ◀── │ (pkl files) │
|
| 150 |
-
└─────────────────┘ └──────────────────┘ └─────────────────┘
|
| 151 |
-
│
|
| 152 |
-
▼
|
| 153 |
-
┌──────────────────┐
|
| 154 |
-
│ Hugging Face │
|
| 155 |
-
│ Model Hub │
|
| 156 |
-
└──────────────────┘
|
| 157 |
-
```
|
| 158 |
-
|
| 159 |
-
## 📁 Files
|
| 160 |
-
|
| 161 |
-
- `app.py` - Main Gradio application
|
| 162 |
-
- `trainer.py` - Advanced model training module
|
| 163 |
-
- `hf_client.py` - Client library for backend integration
|
| 164 |
-
- `requirements.txt` - Python dependencies
|
| 165 |
-
|
| 166 |
-
## 🔧 Local Development
|
| 167 |
-
|
| 168 |
-
```bash
|
| 169 |
-
# Clone the space
|
| 170 |
-
git clone https://huggingface.co/spaces/Che237/cyberforge
|
| 171 |
-
|
| 172 |
-
# Install dependencies
|
| 173 |
-
pip install -r requirements.txt
|
| 174 |
-
|
| 175 |
-
# Run locally
|
| 176 |
-
python app.py
|
| 177 |
-
```
|
| 178 |
-
|
| 179 |
-
## 📄 License
|
| 180 |
-
|
| 181 |
-
MIT License - See LICENSE file for details.
|
| 182 |
-
|
| 183 |
-
## 🤝 Contributing
|
| 184 |
-
|
| 185 |
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
| 186 |
-
|
| 187 |
-
---
|
| 188 |
-
|
| 189 |
-
Built with ❤️ for the cybersecurity community
|
|
|
|
| 1 |
---
|
| 2 |
title: CyberForge AI
|
| 3 |
emoji: 🔐
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.9.1
|
| 8 |
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# CyberForge AI - ML Training Platform
|
| 14 |
|
| 15 |
+
Train cybersecurity ML models and run Jupyter notebooks on Hugging Face.
|
| 16 |
|
| 17 |
+
## Features
|
| 18 |
|
| 19 |
+
- **Notebooks Tab**: Run ML pipeline notebooks directly in the cloud
|
| 20 |
+
- **Train Model**: Upload CSV data and train security models
|
| 21 |
+
- **Inference**: Load trained models and make predictions
|
| 22 |
+
- **API**: REST API for integration
|
| 23 |
|
| 24 |
+
## Notebooks
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
| # | Notebook | Purpose |
|
| 27 |
+
|---|----------|---------|
|
| 28 |
+
| 00 | environment_setup | System validation |
|
| 29 |
+
| 01 | data_acquisition | Data collection |
|
| 30 |
+
| 02 | feature_engineering | Feature extraction |
|
| 31 |
+
| 03 | model_training | Train models |
|
| 32 |
+
| 04 | agent_intelligence | AI reasoning |
|
| 33 |
+
| 05 | model_validation | Testing |
|
| 34 |
+
| 06 | backend_integration | API packaging |
|
| 35 |
+
| 07 | deployment_artifacts | Deployment |
|
| 36 |
|
| 37 |
+
## Links
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
- [Datasets](https://huggingface.co/datasets/Che237/cyberforge-datasets)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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