-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.txt
More file actions
355 lines (211 loc) · 8.58 KB
/
stack.txt
File metadata and controls
355 lines (211 loc) · 8.58 KB
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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
Treść wiadomości Gemini
================================================================================
TECHNOLOGY STACK DESCRIPTION FOR THE "INTI CHECK" PROJECT
PROJECT NAME: IntiCheck - AI Medical Assistant
DESCRIPTION: A discreet web application utilizing artificial intelligence to
classify skin lesions based on photos. The application provides
AI classification along with first-aid advice and medical
recommendations.
================================================================================
BACKEND (SERVER)
================================================================================
FRAMEWORK: Flask (Python Web Framework)
Minimalist, lightweight framework for building web applications
Route management (HTTP paths)
Serving static files (HTML, CSS, JS, manifest.json, sw.js)
Port: 7860 (Configured for Hugging Face Spaces)
FLASK EXTENSIONS:
Flask-CORS: Handling Cross-Origin Resource Sharing (frontend ↔ backend communication)
Allows the frontend to support API requests from various sources
MACHINE LEARNING & IMAGE PROCESSING:
TensorFlow: Deep learning library for loading and running the model
Keras: High-level neural networks API (part of TensorFlow)
Model: inti_check_v5_pro.h5 (trained neural network model)
Architecture: Convolutional Neural Network (CNN)
Input: Images resized to 224x224 pixels
Output: Classification into 6 skin lesion categories
Categories: Fungal infection, Nail problems, Pigmented lesions,
Viral infections, Scabies/Bites, Acne/Purulent lesions
Format: H5 (HDF5 - Hierarchical Data Format)
SUPPORTING LIBRARIES:
NumPy: Numerical processing and array manipulation
Converts images into numerical matrices
Pillow (PIL): Image processing and manipulation
Reading files, resizing, format conversion
Werkzeug: WSGI (Web Server Gateway Interface) utilities
Handling file uploads and HTTP error handling
API ENDPOINTS:
POST /predict - Accepts a photo, returns classification with:
* Category (text)
* Description (what is happening)
* First-aid advice (doraźnie)
* Doctor recommendation
* Confidence score in %
================================================================================
2. FRONTEND (USER INTERFACE)
HTML5:
Semantic document structure
Meta tags for responsiveness (viewport, charset UTF-8)
PWA (Progressive Web App) integration
Progressive Enhancement (works without JS)
CSS3:
CSS Variables (--primary-bg, --accent-green, etc.) - fully responsive
Glassmorphism: Frosted glass effect using backdrop-filter blur(16px)
CSS Grid and Flexbox: Flexible, mobile-first layout
Linear Gradients: Beautiful color transitions (teal → dark green)
CSS Animations: Smooth transitions (0.3s)
Responsive Design: Breakpoints for mobile/tablet/desktop
Components:
Hero section with tags and headers
FAQ Section (Accordion)
Image upload card (glass card)
Photography instructions
HIPAA/Agreement compliance checkbox
JAVASCRIPT:
Event listeners for dropzone and file input
Fetch API: Asynchronous communication with the backend
FormData: Image conversion to binary POST request
DOM manipulation: Dynamic UI updates
Image preview: Previewing the photo before sending
FAQ Toggle: Expanding/collapsing FAQ sections
Error handling: Handling network and validation errors
GOOGLE FONTS:
Outfit (weights: 300, 400, 600, 700)
Modern, clean sans-serif font
================================================================================
3. PROGRESSIVE WEB APP (PWA)
MANIFEST.JSON:
Web app declaration
Metadata: Name, description, theme colors
Icons: 192x192 and 512x512 pixels (PNG)
Display mode: "standalone" (looks like a native app)
Start URL: /index.html
Theme color: #a3e635 (green accent)
Background color: #0f3f38 (teal)
SERVICE WORKER (sw.js):
Background script enabling offline functionality
Cache API: Resource buffering
Offline browsing (if model is pre-loaded)
Push Notifications: Potential notification support
Background Sync: Background data synchronization
Add-to-Home-Screen installation support
BROWSER SUPPORT:
Conditions: Chrome, Edge, Firefox, Safari (modern browsers)
Cache Storage API
IndexedDB (optional for storing results)
================================================================================
4. DOCKER & DEPLOYMENT
DOCKERFILE:
Base Image: python:3.11-slim (lightweight Python 3.11 version)
Size: ~300MB (without the ML model)
Workdir: /app (working directory in the container)
Steps:
Copying requirements.txt
Dependency installation: pip install --no-cache-dir
Copying the entire project
Creating a folder for uploads: /app/uploads
Port exposure: 7860
CMD: Running server.py
HUGGING FACE SPACES:
Integration: Dockerfile is optimized for HF Spaces
Free hosting for public ML projects
Auto-scaling
Port 7860 (default for HF)
REQUIREMENTS.TXT:
flask: Web framework
flask-cors: CORS support
tensorflow: ML framework (≈900MB after installation)
pillow: Image processing
numpy: Numerical computing
werkzeug: WSGI utilities
================================================================================
5. KNOWLEDGE BASE AND BUSINESS LOGIC
KNOWLEDGE_BASE:
Python dictionary with 6 categories
Structure:
{
index: {
"category": string,
"description": string,
"first_aid": string,
"doctor": string (specialist recommendation)
}
}
Each category contains:
Medical description (what the classification means)
First-aid advice (immediate steps)
Recommended doctor specialty with emoji
Dynamically linked with the ML model results
DATA FLOW:
Frontend: User uploads photo (POST /predict)
Backend: Flask receives the file
Processing: Pillow → resize to 224x224 → normalization
AI: TensorFlow/Keras → predict() → vector of 6 outputs
Interpretation: argmax() → category index, max() → confidence %
Enrichment: Attaching text from KNOWLEDGE_BASE
Response: JSON with results + advice
Frontend: Displaying results to the user
================================================================================
6. SECURITY AND PRIVACY
HIPAA COMPLIANCE (Healthcare Privacy):
HIPAA-compliant checkbox on the frontend
Informational (not medical) warnings
Disclaimer: "This is not a medical consultation"
IMAGE UPLOADS:
In-memory processing: processed in RAM without saving to disk
Conversion to RAM buffer
Alpha channel removal (RGBA → RGB)
Normalization: /255.0 (scaling to 0-1 range)
CORS:
Flask-CORS enabled for secure frontend ↔ backend communication
================================================================================
7. GENERAL ARCHITECTURE
PROJECT STRUCTURE:
/
├── server.py (Backend - Flask + TensorFlow)
├── index.html (Frontend - UI)
├── sw.js (Service Worker)
├── manifest.json (PWA config)
├── inti_check_v5_pro.h5 (ML Model - 900MB+)
├── requirements.txt (Python dependencies)
├── Dockerfile (Container config)
└── notes.txt (documentation)
COMMUNICATION:
Browser ↔ (HTTP/HTTPS) ↔ Flask Server
↔ (Local API) ↔ TensorFlow Model
PERFORMANCE:
Inference: ~2-5 seconds (depending on CPU/GPU)
Image: Resize + normalization in RAM
Model cache: Loaded once at startup (warmup)
================================================================================
8. SUPPORTING TECHNOLOGIES
PYTHON VERSION: Python 3.11
OPERATING SYSTEM: Linux (Docker container)
DATABASE: None (stateless application)
CACHE: Browser cache (Service Worker)
CDN: Google Fonts (for typography)
MODERN STANDARDS:
ES6+ JavaScript
CSS Grid/Flexbox
REST API
JSON format
Responsive Web Design
Mobile-First approach
Web Components (potential)
================================================================================
SUMMARY
The IntiCheck project is a modern web application combining:
✓ Deep Learning (TensorFlow/Keras for image classification)
✓ Responsive frontend (HTML5 + CSS3 + Vanilla JS)
✓ Progressive Web App (offline capability)
✓ Lightweight backend (Flask + Python 3.11)
✓ Containerization (Docker for easy deployment)
✓ Free hosting (Hugging Face Spaces)
Optimized for:
User privacy (In-memory processing, no DB)
Speed (Model loaded once, inference in 2-5s)
Accessibility (PWA, offline mode)
Mobility (App installable on the home screen)
================================================================================
Documentation Created: 2026-03-06
Version: 1.0