Spaces:
Running
Running
Syed Arfan
commited on
Commit
Β·
09107be
1
Parent(s):
6d724cf
Improve Mermaid diagram visibility with vibrant colors and black text
Browse files
README.md
CHANGED
|
@@ -28,6 +28,7 @@ A production-ready sentiment analysis API built with FastAPI, featuring multi-se
|
|
| 28 |
## Architecture
|
| 29 |
### System Overview
|
| 30 |
```mermaid
|
|
|
|
| 31 |
graph TB
|
| 32 |
Client[Client Browser]
|
| 33 |
Nginx[nginx Load Balancer<br/>Port 80]
|
|
@@ -46,11 +47,11 @@ graph TB
|
|
| 46 |
API -->|Response| Nginx
|
| 47 |
Nginx -->|Response| Client
|
| 48 |
|
| 49 |
-
style Client fill:#
|
| 50 |
-
style Nginx fill:#
|
| 51 |
-
style API fill:#
|
| 52 |
-
style Redis fill:#
|
| 53 |
-
style Postgres fill:#
|
| 54 |
```
|
| 55 |
|
| 56 |
### Request Flow
|
|
@@ -84,6 +85,7 @@ sequenceDiagram
|
|
| 84 |
|
| 85 |
### Container Architecture
|
| 86 |
```mermaid
|
|
|
|
| 87 |
graph LR
|
| 88 |
subgraph "Docker Compose"
|
| 89 |
N[nginx:alpine15MB]
|
|
@@ -99,15 +101,16 @@ graph LR
|
|
| 99 |
V1[(postgres_dataVolume)]
|
| 100 |
P -.->|persists to| V1
|
| 101 |
|
| 102 |
-
style N fill:#
|
| 103 |
-
style A fill:#
|
| 104 |
-
style R fill:#
|
| 105 |
-
style P fill:#
|
| 106 |
-
style V1 fill:#
|
| 107 |
```
|
| 108 |
|
| 109 |
### Performance Comparison
|
| 110 |
```mermaid
|
|
|
|
| 111 |
graph TD
|
| 112 |
subgraph "Without Cache"
|
| 113 |
A1[Request 1: 100ms] --> A2[Request 2: 100ms]
|
|
@@ -121,8 +124,8 @@ graph TD
|
|
| 121 |
B3 --> B4[1000 requests: 2.1 seconds β‘]
|
| 122 |
end
|
| 123 |
|
| 124 |
-
style A4 fill:#
|
| 125 |
-
style B4 fill:#
|
| 126 |
```
|
| 127 |
|
| 128 |
---
|
|
@@ -351,7 +354,7 @@ sentiment-api/
|
|
| 351 |
1. **User sends request** β nginx (port 80)
|
| 352 |
2. **nginx forwards** β FastAPI (port 8000)
|
| 353 |
3. **FastAPI checks cache** β Redis
|
| 354 |
-
- **Cache HIT**: Return cached result (2ms)
|
| 355 |
- **Cache MISS**: Continue to step 4
|
| 356 |
4. **Run ML model** β DistilBERT inference (100ms)
|
| 357 |
5. **Store in database** β PostgreSQL (persistent)
|
|
@@ -411,7 +414,7 @@ git push origin feature/new-feature
|
|
| 411 |
|
| 412 |
# Create Pull Request on GitHub
|
| 413 |
# GitHub Actions runs tests automatically
|
| 414 |
-
# Merge when tests pass
|
| 415 |
```
|
| 416 |
|
| 417 |
### Updating Dependencies
|
|
|
|
| 28 |
## Architecture
|
| 29 |
### System Overview
|
| 30 |
```mermaid
|
| 31 |
+
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor':'#4fc3f7','primaryTextColor':'#000','primaryBorderColor':'#000','lineColor':'#000','secondaryColor':'#ffb74d','tertiaryColor':'#81c784'}}}%%
|
| 32 |
graph TB
|
| 33 |
Client[Client Browser]
|
| 34 |
Nginx[nginx Load Balancer<br/>Port 80]
|
|
|
|
| 47 |
API -->|Response| Nginx
|
| 48 |
Nginx -->|Response| Client
|
| 49 |
|
| 50 |
+
style Client fill:#4fc3f7,stroke:#000,stroke-width:2px,color:#000
|
| 51 |
+
style Nginx fill:#ffb74d,stroke:#000,stroke-width:2px,color:#000
|
| 52 |
+
style API fill:#81c784,stroke:#000,stroke-width:2px,color:#000
|
| 53 |
+
style Redis fill:#e57373,stroke:#000,stroke-width:2px,color:#000
|
| 54 |
+
style Postgres fill:#ba68c8,stroke:#000,stroke-width:2px,color:#000
|
| 55 |
```
|
| 56 |
|
| 57 |
### Request Flow
|
|
|
|
| 85 |
|
| 86 |
### Container Architecture
|
| 87 |
```mermaid
|
| 88 |
+
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor':'#4fc3f7','primaryTextColor':'#000','primaryBorderColor':'#000','lineColor':'#000'}}}%%
|
| 89 |
graph LR
|
| 90 |
subgraph "Docker Compose"
|
| 91 |
N[nginx:alpine15MB]
|
|
|
|
| 101 |
V1[(postgres_dataVolume)]
|
| 102 |
P -.->|persists to| V1
|
| 103 |
|
| 104 |
+
style N fill:#ffb74d,stroke:#000,stroke-width:2px,color:#000
|
| 105 |
+
style A fill:#81c784,stroke:#000,stroke-width:2px,color:#000
|
| 106 |
+
style R fill:#e57373,stroke:#000,stroke-width:2px,color:#000
|
| 107 |
+
style P fill:#ba68c8,stroke:#000,stroke-width:2px,color:#000
|
| 108 |
+
style V1 fill:#4fc3f7,stroke:#000,stroke-width:2px,color:#000
|
| 109 |
```
|
| 110 |
|
| 111 |
### Performance Comparison
|
| 112 |
```mermaid
|
| 113 |
+
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor':'#4fc3f7','primaryTextColor':'#000','primaryBorderColor':'#000','lineColor':'#000'}}}%%
|
| 114 |
graph TD
|
| 115 |
subgraph "Without Cache"
|
| 116 |
A1[Request 1: 100ms] --> A2[Request 2: 100ms]
|
|
|
|
| 124 |
B3 --> B4[1000 requests: 2.1 seconds β‘]
|
| 125 |
end
|
| 126 |
|
| 127 |
+
style A4 fill:#e57373,stroke:#000,stroke-width:2px,color:#000
|
| 128 |
+
style B4 fill:#81c784,stroke:#000,stroke-width:2px,color:#000
|
| 129 |
```
|
| 130 |
|
| 131 |
---
|
|
|
|
| 354 |
1. **User sends request** β nginx (port 80)
|
| 355 |
2. **nginx forwards** β FastAPI (port 8000)
|
| 356 |
3. **FastAPI checks cache** β Redis
|
| 357 |
+
- **Cache HIT**: Return cached result (2ms)
|
| 358 |
- **Cache MISS**: Continue to step 4
|
| 359 |
4. **Run ML model** β DistilBERT inference (100ms)
|
| 360 |
5. **Store in database** β PostgreSQL (persistent)
|
|
|
|
| 414 |
|
| 415 |
# Create Pull Request on GitHub
|
| 416 |
# GitHub Actions runs tests automatically
|
| 417 |
+
# Merge when tests pass
|
| 418 |
```
|
| 419 |
|
| 420 |
### Updating Dependencies
|