File size: 1,473 Bytes
2a3df01
 
 
 
 
 
 
 
5e5c4c6
 
 
 
2a3df01
 
 
 
 
 
 
 
 
 
 
5e5c4c6
 
2a3df01
 
 
5e5c4c6
2a3df01
 
 
 
 
 
 
 
 
 
 
 
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
---

title: PhishWatch Proxy
emoji: 🛡️
sdk: docker
---


# Hugging Face Space - Phishing Text Classifier (Docker + FastAPI)

This Space exposes two endpoints so the Flutter app can call them reliably:

- `/predict` for text/email/SMS classification via Transformers
- `/predict-url` for URL classification via your scikit-learn Random Forest model

## Files
- Dockerfile - builds a small FastAPI server image
- app.py - FastAPI app that loads the model and returns `{ label, score }`.
- requirements.txt - Python dependencies.

## How to deploy
1. Create a new Space on Hugging Face (type: Docker).
2. Upload the contents of this `hf_space/` folder to the Space root (including Dockerfile).
3. In Space Settings → Variables, add:
   - MODEL_ID = Perth0603/phishing-email-mobilebert

   - URL_REPO = Perth0603/Random-Forest-Model-for-PhishingDetection
   - URL_FILENAME = url_rf_model.joblib  (set to your artifact filename)

4. Wait for the Space to build and become green. Test:

   - GET `/` should return `{ status: ok, model: ... }`

   - POST `/predict` with `{ "inputs": "Win an iPhone! Click here" }`

   - POST `/predict-url` with `{ "url": "https://example.com/login" }`



## Flutter app config

Set the Space URL in your env file so the app targets the Space instead of the Hosted Inference API:



```

{"HF_SPACE_URL":"https://<your-space>.hf.space"}

```



Run the app:

```

flutter run --dart-define-from-file=hf.env.json

```