Polish hackathon documentation
Browse filesAdd Backyard AI Space metadata and consolidate the project, Modal, llama.cpp, trace, and field-note evidence for submission.
Co-Authored-By: Codex <codex@openai.com>
- FIELD_NOTES.md +127 -30
- README.md +162 -127
- experiments/modal_qwen36_mtp/README.md +4 -4
FIELD_NOTES.md
CHANGED
|
@@ -1,49 +1,146 @@
|
|
| 1 |
-
# Field
|
| 2 |
-
|
| 3 |
-
##
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
## Pakistan safety patterns
|
| 24 |
|
| 25 |
-
|
| 26 |
-
and reported examples:
|
| 27 |
|
| 28 |
-
- urgency, threats,
|
| 29 |
- requests for OTPs, PINs, passwords, CVVs, CNIC details, or card data;
|
| 30 |
- payment through message links, personal mobile numbers, wallets, or unusual
|
| 31 |
channels;
|
| 32 |
- impersonation of tax, telecom, banking, traffic, customs, and courier bodies;
|
| 33 |
-
- prizes, refunds,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
##
|
| 39 |
|
|
|
|
| 40 |
- [Gradio Server mode](https://www.gradio.app/main/guides/server-mode)
|
| 41 |
- [Gradio curl and SSE protocol](https://www.gradio.app/main/guides/querying-gradio-apps-with-curl)
|
| 42 |
- [Hugging Face Spaces configuration](https://huggingface.co/docs/hub/spaces-config-reference)
|
| 43 |
-
- [
|
|
|
|
|
|
|
| 44 |
- [FBR fraudulent SMS warning](https://www.fbr.gov.pk/beware-fradulant-sms/152600)
|
| 45 |
- [PTA Complaint Management System](https://complaint.pta.gov.pk/RegisterComplaint.aspx)
|
| 46 |
- [State Bank of Pakistan](https://www.sbp.org.pk/)
|
| 47 |
- [FIA complaint portal](https://complaint.fia.gov.pk/)
|
| 48 |
|
| 49 |
-
Research
|
|
|
|
| 1 |
+
# Field Notes
|
| 2 |
+
|
| 3 |
+
## Problem and scope
|
| 4 |
+
|
| 5 |
+
People in Pakistan regularly receive messages that imitate banks, couriers,
|
| 6 |
+
tax authorities, traffic police, utilities, and mobile operators. The difficult
|
| 7 |
+
part is often not reading the message but deciding what to do next without
|
| 8 |
+
opening an unsafe link, calling an untrusted number, or sharing an OTP.
|
| 9 |
+
|
| 10 |
+
Pakistan Notice Helper is therefore a triage tool, not an authenticity checker.
|
| 11 |
+
It accepts text or a screenshot and returns a risk label, a short explanation,
|
| 12 |
+
visible red flags, and safe next steps. The wording deliberately avoids claims
|
| 13 |
+
that a message is officially genuine or fraudulent.
|
| 14 |
+
|
| 15 |
+
This scope fits the **Backyard AI** track: it addresses a specific local safety
|
| 16 |
+
problem with a model small enough to run through `llama.cpp`.
|
| 17 |
+
|
| 18 |
+
## Product decisions
|
| 19 |
+
|
| 20 |
+
- Use simple English rather than legal or security terminology.
|
| 21 |
+
- Support screenshots because many suspicious messages arrive through SMS,
|
| 22 |
+
WhatsApp, and social media.
|
| 23 |
+
- Treat every URL, phone number, and contact instruction in the submitted
|
| 24 |
+
message as untrusted data.
|
| 25 |
+
- Never invent an assessment when inference fails. The interface shows an
|
| 26 |
+
explicit error instead of falling back to rules or cached samples.
|
| 27 |
+
- Keep built-in examples fast with model-generated cached results, while any
|
| 28 |
+
edited or new input always uses the live model.
|
| 29 |
+
- Show a reply draft only for uncertain cases where clarification may be safe.
|
| 30 |
+
Likely scams do not encourage further engagement.
|
| 31 |
+
|
| 32 |
+
## Small-model stack
|
| 33 |
+
|
| 34 |
+
The primary model is `unsloth/Qwen3.6-27B-MTP-GGUF`, using the
|
| 35 |
+
`Qwen3.6-27B-UD-Q4_K_XL.gguf` quantization and `mmproj-F16.gguf` vision
|
| 36 |
+
projector. At 27B parameters it stays below the hackathon's 32B limit.
|
| 37 |
+
|
| 38 |
+
Modal supplies an L40S GPU and persistent model storage. A pinned,
|
| 39 |
+
CUDA-enabled `llama.cpp` build runs `llama-server` and exposes an
|
| 40 |
+
OpenAI-compatible endpoint. The OpenAI Python package is used only as an HTTP
|
| 41 |
+
client with a custom `base_url`; no request is sent to OpenAI.
|
| 42 |
+
|
| 43 |
+
Key measured results:
|
| 44 |
+
|
| 45 |
+
| Measurement | Result |
|
| 46 |
+
| --- | --- |
|
| 47 |
+
| Model file | 17,909,097,600 bytes |
|
| 48 |
+
| Vision projector | 927,607,360 bytes |
|
| 49 |
+
| Warm-volume model load | 12.03 seconds |
|
| 50 |
+
| GPU memory after load | 17,909 MiB of 46,068 MiB |
|
| 51 |
+
| Structured text inference | 5.27 seconds |
|
| 52 |
+
| Screenshot tests | 8.94 and 9.07 seconds |
|
| 53 |
+
| MTP draft acceptance | 127 of 212 tokens (59.9%) |
|
| 54 |
+
|
| 55 |
+
The full setup and measurements are documented in
|
| 56 |
+
[the model experiment notes](docs/model_experiment_notes.md).
|
| 57 |
+
|
| 58 |
+
## Gradio and Space architecture
|
| 59 |
+
|
| 60 |
+
`gradio.Server` provides queued API routes and Hugging Face Spaces hosting
|
| 61 |
+
without imposing the default Gradio interface. A local HTML, CSS, and
|
| 62 |
+
JavaScript frontend calls the Gradio POST and SSE protocol:
|
| 63 |
+
|
| 64 |
+
```text
|
| 65 |
+
Browser
|
| 66 |
+
-> custom mobile-first frontend
|
| 67 |
+
-> queued gradio.Server endpoint
|
| 68 |
+
-> OpenAI-compatible client
|
| 69 |
+
-> Modal proxy-authenticated web server
|
| 70 |
+
-> CUDA llama.cpp
|
| 71 |
+
-> Qwen3.6 27B MTP GGUF + vision projector
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
The verified Server mode routes are `/gradio_api/call/{api_name}` and
|
| 75 |
+
`/gradio_api/call/{api_name}/{event_id}`. The Space README pins the Gradio
|
| 76 |
+
version and names `app.py` as its entry point.
|
| 77 |
+
|
| 78 |
+
## What failed and changed
|
| 79 |
+
|
| 80 |
+
- Thinking mode initially consumed the 500-token output budget without
|
| 81 |
+
returning final JSON. Disabling thinking produced reliable structured
|
| 82 |
+
responses.
|
| 83 |
+
- A dense Roman Urdu screenshot reached the original completion limit. Image
|
| 84 |
+
requests now receive a larger token budget.
|
| 85 |
+
- One model response suggested an unverified official-looking domain. The
|
| 86 |
+
system prompt now forbids invented URLs, phone numbers, organizations, and
|
| 87 |
+
facts.
|
| 88 |
+
- Modal CLI credentials returned HTTP 401 at the web endpoint. External calls
|
| 89 |
+
require dedicated Modal Proxy Auth credentials.
|
| 90 |
+
- Model availability cannot be hidden behind a rule-based fallback without
|
| 91 |
+
making the product misleading. Failed requests therefore remain visible.
|
| 92 |
+
|
| 93 |
+
## Privacy-safe traces
|
| 94 |
+
|
| 95 |
+
The optional public trace feature is enabled in the interface but can be
|
| 96 |
+
disabled before each request. It records only allow-listed scalar metadata and
|
| 97 |
+
deterministic summaries.
|
| 98 |
+
|
| 99 |
+
Text is redacted and capped at 500 characters. Images are represented by a
|
| 100 |
+
fixed description and are never stored. Public traces exclude raw screenshots,
|
| 101 |
+
links, identifiers, generated explanations, reply text, errors, and
|
| 102 |
+
credentials. Upload failures do not block the user response; pending JSONL
|
| 103 |
+
shards remain available for retry.
|
| 104 |
+
|
| 105 |
+
The dataset and schema are published at
|
| 106 |
+
[build-small-hackathon/pakistan-notice-helper-traces](https://huggingface.co/datasets/build-small-hackathon/pakistan-notice-helper-traces).
|
| 107 |
|
| 108 |
## Pakistan safety patterns
|
| 109 |
|
| 110 |
+
The product focuses on patterns repeatedly present in Pakistani scam
|
| 111 |
+
advisories and reported examples:
|
| 112 |
|
| 113 |
+
- urgency, threats, suspension, arrest, disconnection, or parcel loss;
|
| 114 |
- requests for OTPs, PINs, passwords, CVVs, CNIC details, or card data;
|
| 115 |
- payment through message links, personal mobile numbers, wallets, or unusual
|
| 116 |
channels;
|
| 117 |
- impersonation of tax, telecom, banking, traffic, customs, and courier bodies;
|
| 118 |
+
- prizes, refunds, jobs, rewards, or benefits requiring an advance fee.
|
| 119 |
+
|
| 120 |
+
These signals are warnings, not proof. A familiar logo, sender name, or
|
| 121 |
+
accurate personal detail does not establish authenticity.
|
| 122 |
+
|
| 123 |
+
## Remaining limitations
|
| 124 |
|
| 125 |
+
- The live Space depends on the Modal endpoint and its cold-start behavior.
|
| 126 |
+
- Screenshot quality and dense Roman Urdu text can affect visual recognition.
|
| 127 |
+
- The model can still miss subtle scams or flag legitimate notices.
|
| 128 |
+
- The app does not query government, bank, courier, or telecom databases.
|
| 129 |
+
- A result must always be confirmed through independently located official
|
| 130 |
+
channels before payment or disclosure of personal information.
|
| 131 |
|
| 132 |
+
## References
|
| 133 |
|
| 134 |
+
- [Build Small Hackathon](https://huggingface.co/build-small-hackathon)
|
| 135 |
- [Gradio Server mode](https://www.gradio.app/main/guides/server-mode)
|
| 136 |
- [Gradio curl and SSE protocol](https://www.gradio.app/main/guides/querying-gradio-apps-with-curl)
|
| 137 |
- [Hugging Face Spaces configuration](https://huggingface.co/docs/hub/spaces-config-reference)
|
| 138 |
+
- [Qwen3.6 27B MTP GGUF](https://huggingface.co/unsloth/Qwen3.6-27B-MTP-GGUF)
|
| 139 |
+
- [llama.cpp server](https://github.com/ggml-org/llama.cpp/tree/master/tools/server)
|
| 140 |
+
- [Modal web servers](https://modal.com/docs/guide/webhooks)
|
| 141 |
- [FBR fraudulent SMS warning](https://www.fbr.gov.pk/beware-fradulant-sms/152600)
|
| 142 |
- [PTA Complaint Management System](https://complaint.pta.gov.pk/RegisterComplaint.aspx)
|
| 143 |
- [State Bank of Pakistan](https://www.sbp.org.pk/)
|
| 144 |
- [FIA complaint portal](https://complaint.fia.gov.pk/)
|
| 145 |
|
| 146 |
+
Research and deployment results were reviewed on June 7, 2026.
|
README.md
CHANGED
|
@@ -1,88 +1,114 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Pakistan Notice Helper
|
| 3 |
emoji: 🛡️
|
| 4 |
-
colorFrom: green
|
| 5 |
colorTo: green
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 6.15.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
-
|
| 13 |
-
# Pakistan Notice Helper
|
| 14 |
-
|
| 15 |
-
Pakistan Notice Helper is a model-powered safety assistant for confusing or
|
| 16 |
-
suspicious Pakistani notices, bills, SMS messages, bank alerts, FBR-style
|
| 17 |
-
messages, challans, and courier/customs messages. It accepts pasted text and
|
| 18 |
-
screenshots, then returns:
|
| 19 |
-
|
| 20 |
-
- **Risk label:** Looks normal, Verify first, Suspicious, or Likely scam
|
| 21 |
-
- A simple English explanation
|
| 22 |
-
- Red flags found
|
| 23 |
-
- Safe next steps
|
| 24 |
-
- A polite reply draft
|
| 25 |
-
|
| 26 |
-
The interface is a custom mobile-first frontend served by
|
| 27 |
-
[`gradio.Server`](https://www.gradio.app/main/guides/server-mode). Gradio
|
| 28 |
-
provides queueing, API routes, and Hugging Face Spaces hosting without exposing
|
| 29 |
-
a default Gradio UI.
|
| 30 |
-
|
| 31 |
-
> **Pakistan Notice Helper does not provide official verification. It checks
|
| 32 |
-
> common scam signals and gives safe next steps. Always verify through official
|
| 33 |
> websites or helplines before making payments or sharing personal
|
| 34 |
> information.**
|
| 35 |
|
| 36 |
-
##
|
| 37 |
-
|
| 38 |
-
Python 3.10 or newer is recommended.
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
```
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
| `MODAL_PROXY_KEY` | Optional Modal proxy authentication key |
|
| 70 |
| `MODAL_PROXY_SECRET` | Optional Modal proxy authentication secret |
|
| 71 |
| `HF_TOKEN` | Scoped Hugging Face token used by the background trace uploader |
|
| 72 |
| `HF_TRACE_DATASET_REPO` | Trace dataset repo; defaults to `build-small-hackathon/pakistan-notice-helper-traces` |
|
| 73 |
| `TRACE_BATCH_SIZE` | Trace records per shard; default is 20 |
|
| 74 |
| `TRACE_FLUSH_SECONDS` | Maximum batching delay; default is 60 seconds |
|
| 75 |
-
|
| 76 |
-
The current defaults are:
|
| 77 |
-
|
| 78 |
-
```text
|
| 79 |
-
MODEL_BASE_URL=https://abidali899--pakistan-scam-checker-qwen36-mtp-serve.modal.run
|
| 80 |
-
MODEL_NAME=qwen3.6-27b-mtp
|
| 81 |
-
```
|
| 82 |
-
|
| 83 |
-
See [local model setup](docs/local_model_setup.md) and
|
| 84 |
-
[endpoint testing](docs/model_endpoint_testing.md).
|
| 85 |
-
|
| 86 |
## Model behavior
|
| 87 |
|
| 88 |
The app sends text and optional image data to the configured multimodal
|
|
@@ -98,26 +124,32 @@ There is no rule-based or sample fallback for user-submitted input. If
|
|
| 98 |
credentials are missing, the endpoint is unavailable, or the model returns
|
| 99 |
invalid output, the app displays a clear error and does not manufacture an
|
| 100 |
assessment.
|
| 101 |
-
|
| 102 |
-
## Architecture
|
| 103 |
-
|
| 104 |
-
```text
|
| 105 |
-
Custom HTML/CSS/JavaScript frontend
|
| 106 |
-
|
|
| 107 |
-
| Gradio POST + SSE protocol
|
| 108 |
-
v
|
| 109 |
-
Queued gradio.Server backend
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
|
| 111 |
-
|
|
| 112 |
v
|
| 113 |
-
|
| 114 |
|
|
| 115 |
v
|
| 116 |
unsloth/Qwen3.6-27B-MTP-GGUF
|
| 117 |
```
|
| 118 |
|
| 119 |
All frontend assets are local. The app has no runtime CDN, analytics, OCR, MCP,
|
| 120 |
-
or OpenAI Agents SDK.
|
|
|
|
|
|
|
| 121 |
|
| 122 |
## Sharing is Caring: Open Traces
|
| 123 |
|
|
@@ -156,36 +188,39 @@ python -m traces.scripts.upload_trace_shards --dry-run
|
|
| 156 |
See [the dataset card](traces/dataset_card.md) for the schema, privacy
|
| 157 |
policy, provenance, and limitations.
|
| 158 |
|
| 159 |
-
##
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
|
|
|
|
|
|
|
|
|
| 171 |
- Public traces contain only allow-listed metadata, buckets, booleans, counts,
|
| 172 |
and fixed summaries. Tracing can be disabled per request.
|
| 173 |
-
- Do not upload private personal data unless you trust the Modal deployment.
|
| 174 |
-
- No automated result proves that a notice is genuine or fraudulent.
|
| 175 |
-
- Image analysis requires a multimodal endpoint with its vision projector.
|
| 176 |
-
|
| 177 |
-
## Project structure
|
| 178 |
-
|
| 179 |
-
```text
|
| 180 |
-
app.py
|
| 181 |
-
requirements.txt
|
| 182 |
-
README.md
|
| 183 |
-
FIELD_NOTES.md
|
| 184 |
-
docs/
|
| 185 |
-
local_model_setup.md
|
| 186 |
-
model_endpoint_testing.md
|
| 187 |
-
research_notes.md
|
| 188 |
-
model_experiment_notes.md
|
| 189 |
data/
|
| 190 |
example_assessments.json
|
| 191 |
traces/
|
|
@@ -200,26 +235,26 @@ traces/
|
|
| 200 |
export_pending_traces.py
|
| 201 |
upload_trace_shards.py
|
| 202 |
static/
|
| 203 |
-
index.html
|
| 204 |
-
styles.css
|
| 205 |
-
app.js
|
| 206 |
-
experiments/
|
| 207 |
-
modal_qwen36_mtp/
|
| 208 |
-
```
|
| 209 |
-
|
| 210 |
The six bundled examples have cached Modal assessments and deterministic seed
|
| 211 |
traces. Runtime trace shards are kept out of Git and uploaded separately.
|
| 212 |
-
|
| 213 |
-
## Official reporting channels
|
| 214 |
-
|
| 215 |
-
Use contact details that you navigate to independently:
|
| 216 |
-
|
| 217 |
-
- [PTA Complaint Management System](https://complaint.pta.gov.pk/)
|
| 218 |
-
- [FIA Complaint Portal](https://complaint.fia.gov.pk/)
|
| 219 |
-
- [State Bank of Pakistan](https://www.sbp.org.pk/)
|
| 220 |
-
- [Federal Board of Revenue](https://www.fbr.gov.pk/)
|
| 221 |
-
- The official bank, courier, utility, traffic authority, or government website
|
| 222 |
-
relevant to the notice
|
| 223 |
-
|
| 224 |
-
Never call a number or open a link merely because it appears inside the message
|
| 225 |
-
being checked.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Pakistan Notice Helper
|
| 3 |
emoji: 🛡️
|
| 4 |
+
colorFrom: green
|
| 5 |
colorTo: green
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 6.15.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
+
tags:
|
| 12 |
+
- backyard-ai
|
| 13 |
+
- build-small-hackathon
|
| 14 |
+
- gradio
|
| 15 |
+
- llama.cpp
|
| 16 |
+
- modal
|
| 17 |
---
|
| 18 |
+
|
| 19 |
+
# Pakistan Notice Helper
|
| 20 |
+
|
| 21 |
+
Pakistan Notice Helper is a model-powered safety assistant for confusing or
|
| 22 |
+
suspicious Pakistani notices, bills, SMS messages, bank alerts, FBR-style
|
| 23 |
+
messages, challans, and courier/customs messages. It accepts pasted text and
|
| 24 |
+
screenshots, then returns:
|
| 25 |
+
|
| 26 |
+
- **Risk label:** Looks normal, Verify first, Suspicious, or Likely scam
|
| 27 |
+
- A simple English explanation
|
| 28 |
+
- Red flags found
|
| 29 |
+
- Safe next steps
|
| 30 |
+
- A polite reply draft
|
| 31 |
+
|
| 32 |
+
The interface is a custom mobile-first frontend served by
|
| 33 |
+
[`gradio.Server`](https://www.gradio.app/main/guides/server-mode). Gradio
|
| 34 |
+
provides queueing, API routes, and Hugging Face Spaces hosting without exposing
|
| 35 |
+
a default Gradio UI.
|
| 36 |
+
|
| 37 |
+
> **Pakistan Notice Helper does not provide official verification. It checks
|
| 38 |
+
> common scam signals and gives safe next steps. Always verify through official
|
| 39 |
> websites or helplines before making payments or sharing personal
|
| 40 |
> information.**
|
| 41 |
|
| 42 |
+
## Build Small Hackathon
|
|
|
|
|
|
|
| 43 |
|
| 44 |
+
This is a **Backyard AI** project built for the
|
| 45 |
+
[Build Small Hackathon](https://huggingface.co/build-small-hackathon). It
|
| 46 |
+
addresses a common local problem: people receive convincing payment notices,
|
| 47 |
+
bank alerts, courier messages, challans, and government impersonation scams
|
| 48 |
+
but may not know which details are unsafe.
|
| 49 |
|
| 50 |
+
- **Space:** [build-small-hackathon/pakistan-notice-helper](https://huggingface.co/spaces/build-small-hackathon/pakistan-notice-helper)
|
| 51 |
+
- **Source:** [kingabzpro/pakistan-notice-helper](https://github.com/kingabzpro/pakistan-notice-helper)
|
| 52 |
+
- **Model:** `unsloth/Qwen3.6-27B-MTP-GGUF` (27B parameters)
|
| 53 |
+
- **Inference:** CUDA-enabled `llama.cpp` on a Modal L40S
|
| 54 |
+
- **Interface:** custom mobile-first frontend on `gradio.Server`
|
| 55 |
+
- **Open traces:** [privacy-safe trace dataset](https://huggingface.co/datasets/build-small-hackathon/pakistan-notice-helper-traces)
|
| 56 |
+
- **Build report:** [field notes](FIELD_NOTES.md)
|
| 57 |
|
| 58 |
+
The project targets the Backyard AI main track, OpenAI Codex Track, Modal
|
| 59 |
+
Awards, and the Llama Champion, Off-Brand, Sharing is Caring, and Field Notes
|
| 60 |
+
bonus quests.
|
| 61 |
|
| 62 |
+
## Run locally
|
| 63 |
+
|
| 64 |
+
Python 3.10 or newer is recommended.
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
python -m pip install -r requirements.txt
|
| 68 |
+
python app.py
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
Open `http://127.0.0.1:7860`. Local runs bind to localhost by default. On
|
| 72 |
+
Hugging Face Spaces, the app automatically binds to `0.0.0.0`.
|
| 73 |
+
|
| 74 |
+
Useful checks:
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
python -m py_compile app.py
|
| 78 |
+
python app.py --self-test
|
| 79 |
+
python app.py --test-endpoint
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
The last command requires Modal proxy credentials.
|
| 83 |
+
|
| 84 |
+
## Model configuration
|
| 85 |
+
|
| 86 |
+
The app uses the standard OpenAI Python SDK as a client for an
|
| 87 |
+
OpenAI-compatible endpoint. It does not call OpenAI cloud APIs by default.
|
| 88 |
+
|
| 89 |
+
| Variable | Purpose |
|
| 90 |
+
| --- | --- |
|
| 91 |
+
| `MODEL_BASE_URL` | Optional override for the built-in Modal endpoint |
|
| 92 |
+
| `MODEL_NAME` | Optional override for the built-in model ID |
|
| 93 |
+
| `MODEL_API_KEY` | Optional endpoint API key |
|
| 94 |
+
| `MODEL_TIMEOUT_SECONDS` | Optional request timeout; default is 180 seconds |
|
| 95 |
| `MODAL_PROXY_KEY` | Optional Modal proxy authentication key |
|
| 96 |
| `MODAL_PROXY_SECRET` | Optional Modal proxy authentication secret |
|
| 97 |
| `HF_TOKEN` | Scoped Hugging Face token used by the background trace uploader |
|
| 98 |
| `HF_TRACE_DATASET_REPO` | Trace dataset repo; defaults to `build-small-hackathon/pakistan-notice-helper-traces` |
|
| 99 |
| `TRACE_BATCH_SIZE` | Trace records per shard; default is 20 |
|
| 100 |
| `TRACE_FLUSH_SECONDS` | Maximum batching delay; default is 60 seconds |
|
| 101 |
+
|
| 102 |
+
The current defaults are:
|
| 103 |
+
|
| 104 |
+
```text
|
| 105 |
+
MODEL_BASE_URL=https://abidali899--pakistan-scam-checker-qwen36-mtp-serve.modal.run
|
| 106 |
+
MODEL_NAME=qwen3.6-27b-mtp
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
See [local model setup](docs/local_model_setup.md) and
|
| 110 |
+
[endpoint testing](docs/model_endpoint_testing.md).
|
| 111 |
+
|
| 112 |
## Model behavior
|
| 113 |
|
| 114 |
The app sends text and optional image data to the configured multimodal
|
|
|
|
| 124 |
credentials are missing, the endpoint is unavailable, or the model returns
|
| 125 |
invalid output, the app displays a clear error and does not manufacture an
|
| 126 |
assessment.
|
| 127 |
+
|
| 128 |
+
## Architecture
|
| 129 |
+
|
| 130 |
+
```text
|
| 131 |
+
Custom HTML/CSS/JavaScript frontend
|
| 132 |
+
|
|
| 133 |
+
| Gradio POST + SSE protocol
|
| 134 |
+
v
|
| 135 |
+
Queued gradio.Server backend
|
| 136 |
+
|
|
| 137 |
+
| OpenAI Python SDK
|
| 138 |
+
v
|
| 139 |
+
Deployed/local OpenAI-compatible endpoint
|
| 140 |
|
|
| 141 |
+
| Modal L40S + CUDA llama-server
|
| 142 |
v
|
| 143 |
+
llama.cpp runtime
|
| 144 |
|
|
| 145 |
v
|
| 146 |
unsloth/Qwen3.6-27B-MTP-GGUF
|
| 147 |
```
|
| 148 |
|
| 149 |
All frontend assets are local. The app has no runtime CDN, analytics, OCR, MCP,
|
| 150 |
+
or OpenAI Agents SDK. The OpenAI Python package is only an HTTP client for the
|
| 151 |
+
OpenAI-compatible `llama-server` endpoint; requests are not sent to OpenAI.
|
| 152 |
+
Analysis currently depends on the deployed Modal model.
|
| 153 |
|
| 154 |
## Sharing is Caring: Open Traces
|
| 155 |
|
|
|
|
| 188 |
See [the dataset card](traces/dataset_card.md) for the schema, privacy
|
| 189 |
policy, provenance, and limitations.
|
| 190 |
|
| 191 |
+
## Deployment
|
| 192 |
+
|
| 193 |
+
The app is deployed as a Gradio Space under the Build Small Hackathon
|
| 194 |
+
organization. The metadata at the top of this README pins Gradio, identifies
|
| 195 |
+
the Backyard AI track, and launches `app.py`.
|
| 196 |
+
|
| 197 |
+
Add `MODAL_PROXY_KEY` and `MODAL_PROXY_SECRET` under
|
| 198 |
+
**Space Settings → Secrets**. The endpoint URL and model name are built into
|
| 199 |
+
the app; `MODEL_BASE_URL` and `MODEL_NAME` remain available as overrides for a
|
| 200 |
+
future local deployment.
|
| 201 |
+
|
| 202 |
+
## Privacy and limitations
|
| 203 |
+
|
| 204 |
+
- Submitted text and images are sent to the configured Modal endpoint and are
|
| 205 |
+
not saved by this app.
|
| 206 |
- Public traces contain only allow-listed metadata, buckets, booleans, counts,
|
| 207 |
and fixed summaries. Tracing can be disabled per request.
|
| 208 |
+
- Do not upload private personal data unless you trust the Modal deployment.
|
| 209 |
+
- No automated result proves that a notice is genuine or fraudulent.
|
| 210 |
+
- Image analysis requires a multimodal endpoint with its vision projector.
|
| 211 |
+
|
| 212 |
+
## Project structure
|
| 213 |
+
|
| 214 |
+
```text
|
| 215 |
+
app.py
|
| 216 |
+
requirements.txt
|
| 217 |
+
README.md
|
| 218 |
+
FIELD_NOTES.md
|
| 219 |
+
docs/
|
| 220 |
+
local_model_setup.md
|
| 221 |
+
model_endpoint_testing.md
|
| 222 |
+
research_notes.md
|
| 223 |
+
model_experiment_notes.md
|
| 224 |
data/
|
| 225 |
example_assessments.json
|
| 226 |
traces/
|
|
|
|
| 235 |
export_pending_traces.py
|
| 236 |
upload_trace_shards.py
|
| 237 |
static/
|
| 238 |
+
index.html
|
| 239 |
+
styles.css
|
| 240 |
+
app.js
|
| 241 |
+
experiments/
|
| 242 |
+
modal_qwen36_mtp/
|
| 243 |
+
```
|
| 244 |
+
|
| 245 |
The six bundled examples have cached Modal assessments and deterministic seed
|
| 246 |
traces. Runtime trace shards are kept out of Git and uploaded separately.
|
| 247 |
+
|
| 248 |
+
## Official reporting channels
|
| 249 |
+
|
| 250 |
+
Use contact details that you navigate to independently:
|
| 251 |
+
|
| 252 |
+
- [PTA Complaint Management System](https://complaint.pta.gov.pk/)
|
| 253 |
+
- [FIA Complaint Portal](https://complaint.fia.gov.pk/)
|
| 254 |
+
- [State Bank of Pakistan](https://www.sbp.org.pk/)
|
| 255 |
+
- [Federal Board of Revenue](https://www.fbr.gov.pk/)
|
| 256 |
+
- The official bank, courier, utility, traffic authority, or government website
|
| 257 |
+
relevant to the notice
|
| 258 |
+
|
| 259 |
+
Never call a number or open a link merely because it appears inside the message
|
| 260 |
+
being checked.
|
experiments/modal_qwen36_mtp/README.md
CHANGED
|
@@ -6,10 +6,10 @@ with CUDA-enabled `llama-server` on one Modal L40S. It exposes llama.cpp's
|
|
| 6 |
OpenAI-compatible `/v1/chat/completions` route without calling OpenAI or any
|
| 7 |
cloud LLM API.
|
| 8 |
|
| 9 |
-
This deployment is
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
|
| 14 |
## Configuration
|
| 15 |
|
|
|
|
| 6 |
OpenAI-compatible `/v1/chat/completions` route without calling OpenAI or any
|
| 7 |
cloud LLM API.
|
| 8 |
|
| 9 |
+
This deployment is the hackathon application's primary inference backend. The
|
| 10 |
+
Hugging Face Space sends text and screenshots to this proxy-authenticated
|
| 11 |
+
endpoint, while the same application code can target a local `llama-server`
|
| 12 |
+
through environment-variable overrides.
|
| 13 |
|
| 14 |
## Configuration
|
| 15 |
|