Gaston895 commited on
Commit
740da58
·
1 Parent(s): ec3ad5c

Update branding: Replace original author info with GSS-TEC/AEGIS branding and update version to v1.1.0

Browse files
AEGIS_BIO_DIGITAL_LAB10_INTEGRATION.md ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AEGIS Bio-Digital Lab 10 - Visual System Integration
2
+
3
+ ## Overview
4
+ The sci-image system serves as the **Visual Generation Engine** for AEGIS Bio-Digital Lab 10, providing AI-powered image generation capabilities for scientific visualization across all windows, with primary focus on:
5
+ - **Window 7**: Disease Analysis (viruses, bacteria, pathogens)
6
+ - **Window 9**: Drug Development (molecular structures, drug compounds)
7
+
8
+ ## System Information
9
+ - **Service Name**: AEGIS Bio-Digital Lab 10 - Visual System
10
+ - **Base Technology**: FastSD CPU (Fast Stable Diffusion on CPU)
11
+ - **Primary Use Cases**:
12
+ - Pathogen visualization (viruses, bacteria)
13
+ - Molecular structure generation
14
+ - Scientific illustration
15
+ - **Integration Points**: Window 7 disease discovery, Window 9 drug development completion
16
+
17
+ ## API Endpoints
18
+
19
+ ### Health & Monitoring
20
+
21
+ #### 1. Ping Endpoint (UptimeRobot)
22
+ ```
23
+ GET /api/ping
24
+ ```
25
+ **Purpose**: Health check for UptimeRobot monitoring
26
+ **Response**:
27
+ ```json
28
+ {
29
+ "status": "ok",
30
+ "service": "AEGIS Bio-Digital Lab 10 - Visual System",
31
+ "version": "1.0.0",
32
+ "device": "cpu"
33
+ }
34
+ ```
35
+
36
+ #### 2. Detailed Health Check
37
+ ```
38
+ GET /api/health
39
+ ```
40
+ **Purpose**: Comprehensive system health status
41
+ **Response**:
42
+ ```json
43
+ {
44
+ "status": "healthy",
45
+ "service": "AEGIS Bio-Digital Lab 10 - Visual System",
46
+ "version": "1.0.0",
47
+ "device": "cpu",
48
+ "device_name": "Intel Core i7",
49
+ "platform": "Linux"
50
+ }
51
+ ```
52
+
53
+ #### 3. System Information
54
+ ```
55
+ GET /api/info
56
+ ```
57
+ **Purpose**: Get detailed system information
58
+
59
+ ### Window 7: Disease Analysis Endpoints
60
+
61
+ #### 4. Generate Pathogen Visualization
62
+ ```
63
+ POST /api/window7/generate-pathogen
64
+ ```
65
+ **Purpose**: Generate virus and bacteria visualizations for disease discovery
66
+ **Use Case**: When a disease is discovered in Window 7, generate visual representation of the pathogen
67
+
68
+ **Example Prompts**:
69
+ - "Microscopic view of [virus name] virus, scientific illustration, high detail"
70
+ - "3D structure of [bacteria name] bacteria, medical visualization"
71
+ - "Electron microscope image of [pathogen], scientific accuracy"
72
+ - "Viral structure of COVID-19, detailed scientific diagram"
73
+ - "Bacterial cell structure of E. coli, cross-section view"
74
+
75
+ **Request Body**:
76
+ ```json
77
+ {
78
+ "prompt": "Microscopic view of Ebola virus, scientific illustration, high detail, medical accuracy",
79
+ "negative_prompt": "blurry, low quality, artistic, cartoon",
80
+ "num_inference_steps": 12,
81
+ "guidance_scale": 2.0,
82
+ "width": 512,
83
+ "height": 512,
84
+ "seed": -1,
85
+ "diffusion_task": "text_to_image"
86
+ }
87
+ ```
88
+
89
+ #### 5. Generate Disease Visualization
90
+ ```
91
+ POST /api/window7/generate-disease-visualization
92
+ ```
93
+ **Purpose**: Generate disease progression and infection visualizations
94
+ **Use Case**: Visualize disease symptoms, affected areas, and progression
95
+
96
+ **Example Prompts**:
97
+ - "Medical illustration of [disease] infection in human body"
98
+ - "Disease progression diagram of [condition], scientific style"
99
+ - "Affected organs in [disease], medical visualization"
100
+ - "Cellular damage from [pathogen] infection, microscopic view"
101
+
102
+ ### Window 9: Drug Development Endpoints
103
+
104
+ #### 6. Generate Molecule Visualization
105
+ ```
106
+ POST /api/window9/generate-molecule
107
+ ```
108
+ **Purpose**: Generate molecular structure visualizations
109
+ **Use Case**: After SMILES processing, generate visual representations of molecular structures
110
+
111
+ **Example Prompts**:
112
+ - "3D molecular structure of aspirin, scientific visualization"
113
+ - "Chemical structure diagram of [SMILES notation], high detail"
114
+ - "Molecular bonds and atoms of [drug name], scientific illustration"
115
+ - "Protein-ligand complex, molecular docking visualization"
116
+
117
+ #### 7. Generate Drug Visualization
118
+ ```
119
+ POST /api/window9/generate-drug-visualization
120
+ ```
121
+ **Purpose**: Generate drug compound visualizations
122
+ **Use Case**: Visualize drug candidates and their properties
123
+
124
+ **Example Prompts**:
125
+ - "Drug compound [name] in 3D, pharmaceutical visualization"
126
+ - "Protein-ligand binding visualization for [drug name]"
127
+ - "Drug molecule interaction diagram, scientific style"
128
+
129
+ ### General Scientific Visualization
130
+
131
+ #### 8. Generate Scientific Visualization
132
+ ```
133
+ POST /api/aegis/generate-scientific
134
+ ```
135
+ **Purpose**: General scientific visualization for all AEGIS windows
136
+ **Use Case**: Cross-window scientific imagery generation
137
+
138
+ #### 9. General Image Generation
139
+ ```
140
+ POST /api/generate
141
+ ```
142
+ **Purpose**: Standard image generation endpoint
143
+
144
+ ### Configuration Endpoints
145
+
146
+ #### 10. Get Configuration
147
+ ```
148
+ GET /api/config
149
+ ```
150
+
151
+ #### 11. Get Available Models
152
+ ```
153
+ GET /api/models
154
+ ```
155
+
156
+ ## Integration Workflows
157
+
158
+ ### Window 7: Disease Discovery Flow
159
+
160
+ ```
161
+ 1. Window 7 discovers new disease/pathogen
162
+
163
+ 2. Extract pathogen name and characteristics
164
+
165
+ 3. Call /api/window7/generate-pathogen with descriptive prompt
166
+
167
+ 4. Receive base64-encoded pathogen visualization
168
+
169
+ 5. Display in Window 7 UI alongside disease data
170
+
171
+ 6. Store in disease_analysis_v2 table
172
+ ```
173
+
174
+ ### Window 9: Drug Development Flow
175
+
176
+ ```
177
+ 1. Window 9 completes drug development analysis
178
+
179
+ 2. SMILES notation generated for drug compound
180
+
181
+ 3. Call /api/window9/generate-molecule with molecular prompt
182
+
183
+ 4. Receive base64-encoded molecular structure
184
+
185
+ 5. Display in Window 9 UI
186
+
187
+ 6. Store in drug_development table
188
+ ```
189
+
190
+ ## Example Integration Code
191
+
192
+ ### Window 7: Pathogen Visualization
193
+
194
+ ```javascript
195
+ // After disease discovery in Window 7
196
+ async function generatePathogenVisualization(diseaseData) {
197
+ const response = await fetch('https://sci-image-api.com/api/window7/generate-pathogen', {
198
+ method: 'POST',
199
+ headers: {
200
+ 'Content-Type': 'application/json',
201
+ },
202
+ body: JSON.stringify({
203
+ prompt: `Microscopic view of ${diseaseData.pathogen_name} ${diseaseData.pathogen_type}, scientific illustration, high detail, medical accuracy`,
204
+ negative_prompt: 'blurry, low quality, artistic, cartoon, unrealistic',
205
+ num_inference_steps: 12,
206
+ guidance_scale: 2.0,
207
+ width: 512,
208
+ height: 512,
209
+ seed: -1,
210
+ diffusion_task: 'text_to_image'
211
+ })
212
+ });
213
+
214
+ const result = await response.json();
215
+
216
+ // Store in database
217
+ await fetch('/api/window7/disease-analysis', {
218
+ method: 'PATCH',
219
+ body: JSON.stringify({
220
+ id: diseaseData.id,
221
+ pathogen_image: result.images[0],
222
+ image_generation_latency: result.latency
223
+ })
224
+ });
225
+
226
+ return result.images[0]; // Base64 image
227
+ }
228
+ ```
229
+
230
+ ### Window 9: Molecular Visualization
231
+
232
+ ```javascript
233
+ // After drug development completion in Window 9
234
+ async function generateMolecularVisualization(drugData) {
235
+ const response = await fetch('https://sci-image-api.com/api/window9/generate-molecule', {
236
+ method: 'POST',
237
+ headers: {
238
+ 'Content-Type': 'application/json',
239
+ },
240
+ body: JSON.stringify({
241
+ prompt: `3D molecular structure of ${drugData.compound_name}, SMILES: ${drugData.smiles}, scientific visualization, high detail`,
242
+ negative_prompt: 'blurry, low quality, distorted, artistic',
243
+ num_inference_steps: 10,
244
+ guidance_scale: 1.8,
245
+ width: 512,
246
+ height: 512,
247
+ seed: -1,
248
+ diffusion_task: 'text_to_image'
249
+ })
250
+ });
251
+
252
+ const result = await response.json();
253
+ return result.images[0]; // Base64 image
254
+ }
255
+ ```
256
+
257
+ ## Response Format
258
+
259
+ All generation endpoints return:
260
+ ```json
261
+ {
262
+ "latency": 2.5,
263
+ "images": ["base64_encoded_image_1", "base64_encoded_image_2"],
264
+ "error": null
265
+ }
266
+ ```
267
+
268
+ ## Configuration Parameters
269
+
270
+ ### LCMDiffusionSetting Parameters
271
+
272
+ | Parameter | Type | Default | Description |
273
+ |-----------|------|---------|-------------|
274
+ | `prompt` | string | required | Text description of desired image |
275
+ | `negative_prompt` | string | "" | What to avoid in generation |
276
+ | `num_inference_steps` | int | 4 | Number of denoising steps (4-50) |
277
+ | `guidance_scale` | float | 1.0 | How closely to follow prompt (1.0-2.0) |
278
+ | `width` | int | 512 | Image width in pixels |
279
+ | `height` | int | 512 | Image height in pixels |
280
+ | `seed` | int | -1 | Random seed (-1 for random) |
281
+ | `diffusion_task` | string | "text_to_image" | "text_to_image" or "image_to_image" |
282
+ | `init_image` | string | null | Base64 image for img2img |
283
+ | `strength` | float | 0.8 | Img2img transformation strength |
284
+
285
+ ## Best Practices
286
+
287
+ ### For Pathogen Visualizations (Window 7)
288
+ 1. **Prompt Structure**: "[Pathogen type] view of [pathogen name], scientific illustration, high detail, medical accuracy"
289
+ 2. **Negative Prompts**: Always include "blurry, low quality, artistic, cartoon, unrealistic"
290
+ 3. **Steps**: Use 10-15 steps for medical accuracy
291
+ 4. **Guidance**: Set to 1.8-2.0 for scientific precision
292
+ 5. **Keywords**: Include "microscopic", "electron microscope", "scientific", "medical"
293
+
294
+ **Example Prompts for Common Pathogens**:
295
+ - Viruses: "Electron microscope view of [virus name] virion, detailed capsid structure, scientific accuracy"
296
+ - Bacteria: "Microscopic view of [bacteria name] bacterial cell, flagella visible, scientific illustration"
297
+ - Fungi: "Microscopic structure of [fungus name], spores and hyphae, medical visualization"
298
+ - Parasites: "Detailed view of [parasite name], life cycle stage, scientific diagram"
299
+
300
+ ### For Molecular Visualizations (Window 9)
301
+ 1. **Include SMILES**: Reference SMILES notation in prompt when available
302
+ 2. **Specify Style**: "3D molecular structure", "ball-and-stick model", "space-filling model"
303
+ 3. **Scientific Terms**: Use "bonds", "atoms", "molecular geometry"
304
+ 4. **Steps**: 8-12 for molecular accuracy
305
+ 5. **Guidance**: 1.5-2.0 for precise structures
306
+
307
+ ### Performance Optimization
308
+ 1. Use lower `num_inference_steps` (4-6) for faster generation during development
309
+ 2. Increase steps (10-15) for production/final visualizations
310
+ 3. Cache frequently generated pathogen/molecule images
311
+ 4. Batch multiple requests when generating variations
312
+
313
+ ## Prompt Templates
314
+
315
+ ### Window 7 Templates
316
+
317
+ #### Virus Visualization
318
+ ```
319
+ "Electron microscope view of {virus_name} virus, detailed viral structure, capsid proteins visible, scientific illustration, high detail, medical accuracy"
320
+ ```
321
+
322
+ #### Bacteria Visualization
323
+ ```
324
+ "Microscopic view of {bacteria_name} bacteria, cell wall structure, flagella, scientific illustration, gram stain appearance, medical accuracy"
325
+ ```
326
+
327
+ #### Disease Progression
328
+ ```
329
+ "Medical illustration of {disease_name} infection progression in human {organ/tissue}, cellular level, scientific diagram, pathological changes"
330
+ ```
331
+
332
+ ### Window 9 Templates
333
+
334
+ #### Molecular Structure
335
+ ```
336
+ "3D molecular structure of {compound_name}, SMILES: {smiles_notation}, ball-and-stick model, chemical bonds visible, scientific visualization, high detail"
337
+ ```
338
+
339
+ #### Drug-Protein Interaction
340
+ ```
341
+ "Protein-ligand binding visualization, {drug_name} docking with {protein_name}, molecular interaction diagram, scientific style, binding site highlighted"
342
+ ```
343
+
344
+ ## Monitoring
345
+
346
+ ### UptimeRobot Configuration
347
+ - **Monitor Type**: HTTP(s)
348
+ - **URL**: `https://your-sci-image-api.com/api/ping`
349
+ - **Interval**: 5 minutes
350
+ - **Expected Response**: `200 OK` with `"status": "ok"`
351
+
352
+ ### Health Check Schedule
353
+ - Ping endpoint: Every 5 minutes
354
+ - Health endpoint: Every 15 minutes
355
+ - Full system check: Every hour
356
+
357
+ ## Error Handling
358
+
359
+ ### Common Errors
360
+
361
+ | Error | Cause | Solution |
362
+ |-------|-------|----------|
363
+ | `latency > 30s` | Complex prompt or high steps | Reduce steps or simplify prompt |
364
+ | `images: []` | Generation failed | Check prompt validity |
365
+ | `error: "Out of memory"` | Image too large | Reduce dimensions |
366
+ | `error: "Model not loaded"` | Model initialization failed | Restart service |
367
+
368
+ ## Database Integration
369
+
370
+ ### Window 7: Storing Pathogen Images
371
+
372
+ ```sql
373
+ -- Add pathogen_image column to disease_analysis_v2
374
+ ALTER TABLE disease_analysis_v2
375
+ ADD COLUMN pathogen_image TEXT,
376
+ ADD COLUMN pathogen_image_prompt TEXT,
377
+ ADD COLUMN image_generation_latency REAL;
378
+ ```
379
+
380
+ ### Window 9: Storing Molecular Images
381
+
382
+ ```sql
383
+ -- Add molecular_image column to drug_development
384
+ ALTER TABLE drug_development
385
+ ADD COLUMN molecular_structure_image TEXT,
386
+ ADD COLUMN molecular_image_prompt TEXT,
387
+ ADD COLUMN image_generation_latency REAL;
388
+ ```
389
+
390
+ ## Deployment
391
+
392
+ ### Environment Variables
393
+ ```bash
394
+ DEVICE=cpu
395
+ APP_VERSION=1.0.0
396
+ PORT=8000
397
+ ```
398
+
399
+ ### Docker Deployment
400
+ ```bash
401
+ docker build -t aegis-visual-system .
402
+ docker run -p 8000:8000 aegis-visual-system
403
+ ```
404
+
405
+ ### Hugging Face Space
406
+ - SDK: Docker
407
+ - App Port: 7860
408
+ - Python Version: 3.12 (see `.python-version`)
409
+
410
+ ## Future Enhancements
411
+
412
+ 1. **GPU Acceleration**: Add CUDA support for faster generation
413
+ 2. **Model Fine-tuning**: Train on medical/scientific imagery datasets
414
+ 3. **3D Rendering**: Generate rotatable 3D pathogen/molecule models
415
+ 4. **Animation**: Create pathogen lifecycle and molecular interaction animations
416
+ 5. **Style Transfer**: Apply scientific paper/textbook style
417
+ 6. **Batch Processing**: Generate multiple variations simultaneously
418
+ 7. **Real-time Generation**: WebSocket support for live visualization
419
+
420
+ ## Version History
421
+
422
+ - **v1.0.0** (2026-05-31): Initial AEGIS Bio-Digital Lab 10 integration
423
+ - Added ping endpoint for UptimeRobot
424
+ - Added Window 7 pathogen visualization endpoints
425
+ - Added Window 9 molecular visualization endpoints
426
+ - Added AEGIS scientific visualization endpoint
427
+ - Added comprehensive health checks
428
+ - Integrated with disease discovery and drug development workflows
src/backend/api/web.py CHANGED
@@ -16,8 +16,8 @@ from state import get_settings
16
 
17
  app_settings = get_settings()
18
  app = FastAPI(
19
- title="FastSD CPU",
20
- description="Fast stable diffusion on CPU",
21
  version=APP_VERSION,
22
  license_info={
23
  "name": "MIT",
@@ -41,7 +41,39 @@ context = Context(InterfaceType.API_SERVER)
41
 
42
  @app.get("/api/")
43
  async def root():
44
- return {"message": "Welcome to FastSD CPU API"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
 
47
  @app.get(
@@ -108,6 +140,162 @@ async def generate(diffusion_config: LCMDiffusionSetting) -> StableDiffusionResp
108
  )
109
 
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  def start_web_server(port: int = 8000):
112
  uvicorn.run(
113
  app,
 
16
 
17
  app_settings = get_settings()
18
  app = FastAPI(
19
+ title="AEGIS Bio-Digital Lab 10 - Visual System",
20
+ description="Scientific visualization system for pathogen and molecular structure generation",
21
  version=APP_VERSION,
22
  license_info={
23
  "name": "MIT",
 
41
 
42
  @app.get("/api/")
43
  async def root():
44
+ return {"message": "Welcome to AEGIS Bio-Digital Lab 10 - Visual System API"}
45
+
46
+
47
+ @app.get(
48
+ "/api/ping",
49
+ description="Health check endpoint for UptimeRobot monitoring",
50
+ summary="Ping endpoint",
51
+ )
52
+ async def ping():
53
+ """Health check endpoint for monitoring services like UptimeRobot"""
54
+ return {
55
+ "status": "ok",
56
+ "service": "AEGIS Bio-Digital Lab 10 - Visual System",
57
+ "version": APP_VERSION,
58
+ "device": DEVICE,
59
+ }
60
+
61
+
62
+ @app.get(
63
+ "/api/health",
64
+ description="Detailed health check with system status",
65
+ summary="Health check",
66
+ )
67
+ async def health():
68
+ """Detailed health check endpoint"""
69
+ return {
70
+ "status": "healthy",
71
+ "service": "AEGIS Bio-Digital Lab 10 - Visual System",
72
+ "version": APP_VERSION,
73
+ "device": DEVICE,
74
+ "device_name": get_device_name(),
75
+ "platform": platform.system(),
76
+ }
77
 
78
 
79
  @app.get(
 
140
  )
141
 
142
 
143
+ @app.post(
144
+ "/api/window7/generate-pathogen",
145
+ description="Generate virus or bacteria visualization for Window 7 Disease Analysis",
146
+ summary="Generate pathogen visualization",
147
+ )
148
+ async def generate_pathogen_visualization(diffusion_config: LCMDiffusionSetting) -> StableDiffusionResponse:
149
+ """
150
+ Generate virus and bacteria visualizations for AEGIS Bio-Digital Lab 10 Window 7.
151
+ Used for disease discovery and pathogen identification visualization.
152
+ """
153
+ app_settings.settings.lcm_diffusion_setting = diffusion_config
154
+
155
+ if diffusion_config.diffusion_task == DiffusionTask.image_to_image:
156
+ app_settings.settings.lcm_diffusion_setting.init_image = base64_image_to_pil(
157
+ diffusion_config.init_image
158
+ )
159
+
160
+ images = context.generate_text_to_image(app_settings.settings)
161
+
162
+ if images:
163
+ images_base64 = [pil_image_to_base64_str(img) for img in images]
164
+ else:
165
+ images_base64 = []
166
+
167
+ return StableDiffusionResponse(
168
+ latency=round(context.latency, 2),
169
+ images=images_base64,
170
+ error=context.error,
171
+ )
172
+
173
+
174
+ @app.post(
175
+ "/api/window7/generate-disease-visualization",
176
+ description="Generate disease and infection visualization for Window 7",
177
+ summary="Generate disease visualization",
178
+ )
179
+ async def generate_disease_visualization(diffusion_config: LCMDiffusionSetting) -> StableDiffusionResponse:
180
+ """
181
+ Generate disease and infection visualizations for AEGIS Bio-Digital Lab 10 Window 7.
182
+ Used for visualizing disease progression, symptoms, and affected areas.
183
+ """
184
+ app_settings.settings.lcm_diffusion_setting = diffusion_config
185
+
186
+ if diffusion_config.diffusion_task == DiffusionTask.image_to_image:
187
+ app_settings.settings.lcm_diffusion_setting.init_image = base64_image_to_pil(
188
+ diffusion_config.init_image
189
+ )
190
+
191
+ images = context.generate_text_to_image(app_settings.settings)
192
+
193
+ if images:
194
+ images_base64 = [pil_image_to_base64_str(img) for img in images]
195
+ else:
196
+ images_base64 = []
197
+
198
+ return StableDiffusionResponse(
199
+ latency=round(context.latency, 2),
200
+ images=images_base64,
201
+ error=context.error,
202
+ )
203
+
204
+
205
+ @app.post(
206
+ "/api/window9/generate-molecule",
207
+ description="Generate molecular structure visualization for Window 9",
208
+ summary="Generate molecule visualization",
209
+ )
210
+ async def generate_molecule_visualization(diffusion_config: LCMDiffusionSetting) -> StableDiffusionResponse:
211
+ """
212
+ Generate molecular structure visualizations for AEGIS Bio-Digital Lab 10 Window 9.
213
+ Used for drug development visualization after SMILES processing.
214
+ """
215
+ app_settings.settings.lcm_diffusion_setting = diffusion_config
216
+
217
+ # Ensure we're doing text-to-image for molecular structures
218
+ if diffusion_config.diffusion_task == DiffusionTask.image_to_image:
219
+ app_settings.settings.lcm_diffusion_setting.init_image = base64_image_to_pil(
220
+ diffusion_config.init_image
221
+ )
222
+
223
+ images = context.generate_text_to_image(app_settings.settings)
224
+
225
+ if images:
226
+ images_base64 = [pil_image_to_base64_str(img) for img in images]
227
+ else:
228
+ images_base64 = []
229
+
230
+ return StableDiffusionResponse(
231
+ latency=round(context.latency, 2),
232
+ images=images_base64,
233
+ error=context.error,
234
+ )
235
+
236
+
237
+ @app.post(
238
+ "/api/window9/generate-drug-visualization",
239
+ description="Generate drug compound visualization for Window 9",
240
+ summary="Generate drug visualization",
241
+ )
242
+ async def generate_drug_visualization(diffusion_config: LCMDiffusionSetting) -> StableDiffusionResponse:
243
+ """
244
+ Generate drug compound visualizations for AEGIS Bio-Digital Lab 10 Window 9.
245
+ Used for visualizing drug candidates and their properties.
246
+ """
247
+ app_settings.settings.lcm_diffusion_setting = diffusion_config
248
+
249
+ if diffusion_config.diffusion_task == DiffusionTask.image_to_image:
250
+ app_settings.settings.lcm_diffusion_setting.init_image = base64_image_to_pil(
251
+ diffusion_config.init_image
252
+ )
253
+
254
+ images = context.generate_text_to_image(app_settings.settings)
255
+
256
+ if images:
257
+ images_base64 = [pil_image_to_base64_str(img) for img in images]
258
+ else:
259
+ images_base64 = []
260
+
261
+ return StableDiffusionResponse(
262
+ latency=round(context.latency, 2),
263
+ images=images_base64,
264
+ error=context.error,
265
+ )
266
+
267
+
268
+ @app.post(
269
+ "/api/aegis/generate-scientific",
270
+ description="Generate scientific visualization for AEGIS Bio-Digital Lab 10",
271
+ summary="Generate scientific visualization",
272
+ )
273
+ async def generate_scientific_visualization(diffusion_config: LCMDiffusionSetting) -> StableDiffusionResponse:
274
+ """
275
+ General scientific visualization endpoint for AEGIS Bio-Digital Lab 10.
276
+ Can be used across all windows for generating scientific imagery.
277
+ """
278
+ app_settings.settings.lcm_diffusion_setting = diffusion_config
279
+
280
+ if diffusion_config.diffusion_task == DiffusionTask.image_to_image:
281
+ app_settings.settings.lcm_diffusion_setting.init_image = base64_image_to_pil(
282
+ diffusion_config.init_image
283
+ )
284
+
285
+ images = context.generate_text_to_image(app_settings.settings)
286
+
287
+ if images:
288
+ images_base64 = [pil_image_to_base64_str(img) for img in images]
289
+ else:
290
+ images_base64 = []
291
+
292
+ return StableDiffusionResponse(
293
+ latency=round(context.latency, 2),
294
+ images=images_base64,
295
+ error=context.error,
296
+ )
297
+
298
+
299
  def start_web_server(port: int = 8000):
300
  uvicorn.run(
301
  app,
src/constants.py CHANGED
@@ -2,10 +2,10 @@ from os import environ, cpu_count
2
 
3
  cpu_cores = cpu_count()
4
  cpus = cpu_cores // 2 if cpu_cores else 0
5
- APP_VERSION = "v1.0.0 beta 281"
6
  LCM_DEFAULT_MODEL = "stabilityai/sd-turbo"
7
  LCM_DEFAULT_MODEL_OPENVINO = "rupeshs/sd-turbo-openvino"
8
- APP_NAME = "FastSD CPU"
9
  APP_SETTINGS_FILE = "settings.yaml"
10
  RESULTS_DIRECTORY = "results"
11
  CONFIG_DIRECTORY = "configs"
 
2
 
3
  cpu_cores = cpu_count()
4
  cpus = cpu_cores // 2 if cpu_cores else 0
5
+ APP_VERSION = "v1.1.0"
6
  LCM_DEFAULT_MODEL = "stabilityai/sd-turbo"
7
  LCM_DEFAULT_MODEL_OPENVINO = "rupeshs/sd-turbo-openvino"
8
+ APP_NAME = "AEGIS Bio-Digital Lab 10 - Visual System"
9
  APP_SETTINGS_FILE = "settings.yaml"
10
  RESULTS_DIRECTORY = "results"
11
  CONFIG_DIRECTORY = "configs"
src/frontend/gui/app_window.py CHANGED
@@ -363,11 +363,11 @@ class MainWindow(QMainWindow):
363
  self.label.setAlignment(Qt.AlignCenter)
364
  current_year = datetime.now().year
365
  self.label.setText(
366
- f"""<h1>FastSD CPU {APP_VERSION}</h1>
367
- <h3>(c)2023 - {current_year} Rupesh Sreeraman</h3>
368
- <h3>Faster stable diffusion on CPU</h3>
369
- <h3>Based on Latent Consistency Models</h3>
370
- <h3>GitHub : https://github.com/rupeshs/fastsdcpu/</h3>"""
371
  )
372
 
373
  vlayout = QVBoxLayout()
 
363
  self.label.setAlignment(Qt.AlignCenter)
364
  current_year = datetime.now().year
365
  self.label.setText(
366
+ f"""<h1>AEGIS Bio-Digital Lab 10 - Visual System</h1>
367
+ <h3>© {current_year} GSS-TEC</h3>
368
+ <h3>Scientific Visualization for Pathogen & Molecular Structure Generation</h3>
369
+ <h3>Contact: info@gss-tec.com</h3>
370
+ <h3>Website: https://www.gss-tec.com</h3>"""
371
  )
372
 
373
  vlayout = QVBoxLayout()
src/frontend/webui/hf_demo.py CHANGED
@@ -109,13 +109,12 @@ footer {
109
 
110
 
111
  def _get_footer_message() -> str:
112
- version = f"<center><p> {APP_VERSION} "
113
  current_year = datetime.now().year
114
- footer_msg = version + (
115
- f' © {current_year} <a href="https://github.com/rupeshs">'
116
- " Rupesh Sreeraman</a></p></center>"
117
  )
118
- warning_msg = "<p><b> Please note that this is a minimal demo app.</b> </p><br>"
119
  return warning_msg + footer_msg
120
 
121
 
@@ -123,16 +122,19 @@ with gr.Blocks(css=css) as demo:
123
  with gr.Column(elem_id="container"):
124
  use_openvino = "" if is_openvino_device() else ""
125
  gr.Markdown(
126
- f"""# FastSD CPU demo {use_openvino}
127
  **Device : {DEVICE.upper()} , {get_device_name()} | OpenVINO**
 
 
 
128
  """,
129
  elem_id="intro",
130
  )
131
  gr.HTML(
132
  f"""
133
  <p id="project-links" align="center">
134
- <a href='https://github.com/rupeshs/fastsdcpu'><img src='https://img.shields.io/badge/Project-Page-Green'></a>
135
- </p>
136
  """
137
  )
138
 
 
109
 
110
 
111
  def _get_footer_message() -> str:
 
112
  current_year = datetime.now().year
113
+ footer_msg = (
114
+ f'<center><p>© {current_year} <a href="https://www.gss-tec.com">'
115
+ " GSS-TEC</a> | <a href=\"mailto:info@gss-tec.com\">info@gss-tec.com</a></p></center>"
116
  )
117
+ warning_msg = "<p><b>AEGIS Bio-Digital Lab 10 - Scientific Visualization System for Disease & Drug Discovery</b></p><br>"
118
  return warning_msg + footer_msg
119
 
120
 
 
122
  with gr.Column(elem_id="container"):
123
  use_openvino = "" if is_openvino_device() else ""
124
  gr.Markdown(
125
+ f"""# AEGIS Bio-Digital Lab 10 - Visual System {use_openvino}
126
  **Device : {DEVICE.upper()} , {get_device_name()} | OpenVINO**
127
+ **Scientific Visualization for Pathogen & Molecular Structure Generation**
128
+
129
+ *Powered by [GSS-TEC](https://www.gss-tec.com) | Contact: [info@gss-tec.com](mailto:info@gss-tec.com)*
130
  """,
131
  elem_id="intro",
132
  )
133
  gr.HTML(
134
  f"""
135
  <p id="project-links" align="center">
136
+ <a href='https://www.gss-tec.com'><img src='https://img.shields.io/badge/GSS--TEC-Website-Blue'></a>
137
+ </p>
138
  """
139
  )
140
 
src/frontend/webui/realtime_ui.py CHANGED
@@ -82,11 +82,10 @@ footer {
82
 
83
 
84
  def _get_footer_message() -> str:
85
- version = f"<center><p> {APP_VERSION} "
86
  current_year = datetime.now().year
87
- footer_msg = version + (
88
- f' © 2023 - {current_year} <a href="https://github.com/rupeshs">'
89
- " Rupesh Sreeraman</a></p></center>"
90
  )
91
  return footer_msg
92
 
@@ -95,7 +94,7 @@ with gr.Blocks(css=css) as demo:
95
  with gr.Column(elem_id="container"):
96
  use_openvino = "- OpenVINO" if is_openvino_device() else ""
97
  gr.Markdown(
98
- f"""# Realtime FastSD CPU {use_openvino}
99
  **Device : {DEVICE} , {get_device_name()}**
100
  """,
101
  elem_id="intro",
 
82
 
83
 
84
  def _get_footer_message() -> str:
 
85
  current_year = datetime.now().year
86
+ footer_msg = (
87
+ f'<center><p>© {current_year} <a href="https://www.gss-tec.com">'
88
+ " GSS-TEC</a> | <a href=\"mailto:info@gss-tec.com\">info@gss-tec.com</a></p></center>"
89
  )
90
  return footer_msg
91
 
 
94
  with gr.Column(elem_id="container"):
95
  use_openvino = "- OpenVINO" if is_openvino_device() else ""
96
  gr.Markdown(
97
+ f"""# AEGIS Bio-Digital Lab 10 - Realtime Visual System {use_openvino}
98
  **Device : {DEVICE} , {get_device_name()}**
99
  """,
100
  elem_id="intro",
src/frontend/webui/ui.py CHANGED
@@ -17,11 +17,10 @@ app_settings = get_settings()
17
 
18
 
19
  def _get_footer_message() -> str:
20
- version = f"<center><p> {APP_VERSION} "
21
  current_year = datetime.now().year
22
- footer_msg = version + (
23
- f' © 2023 - {current_year} <a href="https://github.com/rupeshs">'
24
- " Rupesh Sreeraman</a></p></center>"
25
  )
26
  return footer_msg
27
 
@@ -49,11 +48,11 @@ def get_web_ui() -> gr.Blocks:
49
  primary_hue="blue",
50
  )
51
  with gr.Blocks(
52
- title="FastSD CPU",
53
  theme=theme,
54
  css="footer {visibility: hidden}",
55
  ) as fastsd_web_ui:
56
- gr.HTML("<center><H1>FastSD CPU</H1></center>")
57
  gr.Markdown(
58
  f"**Processor : {get_device_name()}**",
59
  elem_id="processor",
 
17
 
18
 
19
  def _get_footer_message() -> str:
 
20
  current_year = datetime.now().year
21
+ footer_msg = (
22
+ f'<center><p>© {current_year} <a href="https://www.gss-tec.com">'
23
+ " GSS-TEC</a> | <a href=\"mailto:info@gss-tec.com\">info@gss-tec.com</a></p></center>"
24
  )
25
  return footer_msg
26
 
 
48
  primary_hue="blue",
49
  )
50
  with gr.Blocks(
51
+ title="AEGIS Bio-Digital Lab 10",
52
  theme=theme,
53
  css="footer {visibility: hidden}",
54
  ) as fastsd_web_ui:
55
+ gr.HTML("<center><H1>AEGIS Bio-Digital Lab 10 - Visual System</H1></center>")
56
  gr.Markdown(
57
  f"**Processor : {get_device_name()}**",
58
  elem_id="processor",