mabera commited on
Commit
01903b6
Β·
verified Β·
1 Parent(s): 14a2174

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +131 -36
app.py CHANGED
@@ -1,31 +1,33 @@
1
  import gradio as gr
2
  import spaces
3
 
4
- # Africa HIV Funding Disruption AI Demo
5
  # AutoScientist Challenge 2026, Part 2 | Science Category
6
  # Author: Hussein Adeiza (mabera) β€” Licensed Environmental Health Officer, Abuja Nigeria
7
 
 
8
  # ── HIV Funding & Response Interpreter ──────────────────────
 
9
  HIV_EXAMPLES = {
10
  "Regional donor dependency split (West/Central vs East/Southern Africa)": {
11
  "stats": "Donors cover approximately 90 percent of antiretroviral (ARV) drug costs in West and Central Africa, compared to approximately 38 percent in East and Southern Africa. Several high-burden East and Southern African countries are almost entirely dependent on PEPFAR specifically for HIV prevention programs: Malawi at 88.5 percent, Zimbabwe at 82.7 percent, and Mozambique at 81.8 percent. By contrast, South Africa, Botswana, Kenya, and Namibia each rely on PEPFAR for below 25 percent of their prevention funding.",
12
- "interpretation": "The regional split matters more than the continental average suggests: West and Central Africa's near-total donor dependency for treatment costs (90 percent) means any disruption there would affect ongoing ARV supply directly, while East and Southern Africa's lower regional average for treatment (38 percent) masks enormous country-level variance specifically in prevention funding, where Malawi, Zimbabwe, and Mozambique sit above 80 percent dependency while South Africa, Botswana, Kenya, and Namibia sit below 25 percent. A single continental narrative about 'Africa's HIV response' obscures two fundamentally different risk profiles: countries like South Africa have the domestic fiscal capacity to absorb a funding shock to prevention programs, while Malawi, Zimbabwe, and Mozambique have comparatively little room to do so without an immediate service collapse."
13
  },
14
  "The 2025 PrEP collapse and Nigeria's disproportionate hit": {
15
  "stats": "PrEP use across 62 reporting countries fell from 3.3 million people in 2024 to 2.1 million in 2025, a 38 percent decline, including in Nigeria, Cameroon, and Uganda. In Nigeria specifically, monthly PrEP initiations fell from approximately 40,000 to approximately 6,000 following budget cuts, an 85 percent reduction. Meanwhile, the DREAMS programme, which had targeted 2 million adolescent girls and young women across 10 countries for HIV prevention, halted entirely in all 10 countries.",
16
- "interpretation": "The gap between the 38 percent multi-country PrEP decline and Nigeria's 85 percent collapse in monthly initiations suggests Nigeria's prevention infrastructure was disproportionately exposed compared to the average reporting country, likely reflecting how concentrated Nigeria's PrEP delivery was within externally funded programs specifically, rather than blended with domestic health system capacity. The complete halt of DREAMS across all 10 countries, rather than a partial reduction, indicates this was a program entirely dependent on a single funding source with no domestic or alternative donor bridge in place. Together these findings point to a design vulnerability common across HIV prevention programming: prevention services appear to have been built with less redundancy and fewer domestic funding backstops than treatment programs."
17
  },
18
  "Mozambique: a real, measured case study": {
19
  "stats": "In Mozambique, where PEPFAR has funded roughly two-thirds of the national HIV program for over a decade, comparing February to May 2025 against the same period in 2024 shows more than 15,000 fewer people started antiretroviral treatment, a 14 percent reduction. Viral load testing fell 38 percent in adults and 44 percent in children, while viral suppression rates among those tested fell 33 percent in adults and 43 percent in children.",
20
- "interpretation": "The consistent pattern of children being harder hit than adults across both viral load testing (44 percent vs 38 percent decline) and viral suppression (43 percent vs 33 percent decline) suggests pediatric HIV services in Mozambique were more concentrated in the disrupted funding stream than adult services. The combination of falling testing rates and falling suppression rates among those still tested is a compounding problem rather than two separate ones: fewer children are being monitored at all, and among those who are monitored, a larger share are failing treatment. This four-month snapshot from a single country provides a concrete, measured example of what larger continental modeling projections describe in the abstract."
21
  },
22
  "2030 modeling: why treatment funding matters as much as prevention": {
23
- "stats": "Modeling presented at the 2025 International AIDS Society Conference projected two scenarios through 2030. A moderate scenario, with prevention and testing funding cut by 24 percent by 2026 but treatment sustained by domestic funding, would result in 71,500 to 1.7 million additional new HIV infections. A severe scenario, adding full PEPFAR discontinuation on top of the same prevention cuts, would result in 4.4 million to 10.8 million additional new infections.",
24
- "interpretation": "The roughly 6-fold jump in the upper-bound infection estimate between the moderate and severe scenarios is not proportional to the funding change between the two scenarios, since the severe scenario only adds full PEPFAR discontinuation on top of the same prevention cuts already present in the moderate scenario. This disproportionate jump indicates that treatment funding, not just prevention funding, plays an outsized protective role against new infections, likely because people on suppressive treatment do not transmit the virus, so treatment discontinuation removes a prevention mechanism in addition to a care mechanism."
25
  },
26
  "The resilience counter-narrative: treatment held, prevention didn't": {
27
- "stats": "Despite the 2025 funding disruptions, the number of people on antiretroviral treatment globally rose 2.7 percent year-on-year to 32.1 million by December 2025, though below the roughly 4 percent historical average. Domestic funding's share of total HIV resources in low and middle-income countries rose to approximately 52 percent in 2024, up from 28 percent in 2010. As of the 2026 reporting period, 25 of 60 low and middle-income countries had increased their domestic HIV budgets for 2026, averaging about 8 percent, roughly 180 million additional dollars combined.",
28
- "interpretation": "The continued growth in treatment numbers despite the funding shock indicates the treatment system had more built-in resilience than the prevention system. The rise in domestic funding share from 28 to 52 percent over 15 years represents genuine structural progress, but this trend predates the 2025 disruption; the more relevant figure is that only 25 of 60 countries increased domestic budgets specifically for 2026, and that roughly 180 million dollars combined is a small fraction of a single year of PEPFAR's $4.3 billion bilateral commitment. Domestic funding growth, while a genuine long-term positive trend, is not currently happening at a scale capable of substituting for the 2025 funding shock."
29
  },
30
  }
31
 
@@ -34,55 +36,119 @@ def interpret_hiv_stats(selected_example, custom_stats):
34
  if custom_stats and custom_stats.strip():
35
  return f"""
36
  ## 🌍 HIV Funding & Response Interpretation
37
-
38
  **Input stats:** {custom_stats}
39
-
40
- **Note:** This is a demo using pre-built reference interpretations from cited sources. For genuinely novel statistics, the fine-tuned model (linked below) would generate a fresh interpretation, this demo shows the pattern using the cited training examples rather than live inference.
41
-
42
- Try selecting one of the dropdown examples instead to see a real cited interpretation.
43
-
44
  ---
45
  *Africa HIV Funding Analysis Model β€” Fine-tuned Llama 4 Scout 17B-16E | AutoScientist 2026 Part 2*
46
  """
47
  example = HIV_EXAMPLES.get(selected_example, list(HIV_EXAMPLES.values())[0])
48
  return f"""
49
  ## 🌍 HIV Funding & Response Interpretation
50
-
51
  **Raw cited statistics (input):**
52
  {example['stats']}
53
-
54
  **Structured public health interpretation (output):**
55
  {example['interpretation']}
56
-
57
  ---
58
- ### About this model
59
- This model takes raw statistics on Africa's HIV funding structure and the 2025 disruption, and produces structured public health analytical reasoning. All training examples are cited to UNAIDS, IAS 2025 conference findings, Health Policy Watch, and CNBC Africa reporting.
60
-
61
- ⚠️ All interpretation stays strictly within what the cited source data supports.
62
-
63
  ### ⚠️ Important Disclosure
64
- This dataset was intended for the **Science** category. The platform's automatic content classifier repeatedly labeled it News/Governance/Medical instead of Science, which appears to have determined that this model trained on **Llama 4 Scout 17B-16E** rather than Llama 3.3 70B, used by every other model in this author's portfolio. This was reported to the Adaption team as a potential platform issue prior to publication. Win rate on the training dataset was 71%, with a 60% General Win Rate benchmarked against News-domain tasks, not Science. Full disclosure available in the model card.
65
 
66
  *Africa HIV Funding Analysis Model β€” Fine-tuned Llama 4 Scout 17B-16E | AutoScientist 2026 | Science Category*
67
  *Powered by Adaptive Data β€” Adaption Labs*
68
  """
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  # ── Build Interface ─────────────────────────────────────────
71
- with gr.Blocks(title="Africa HIV Funding AI") as demo:
 
72
  gr.Markdown("""
73
- # 🌍 Africa HIV Funding & Response AI Demo
74
  ## AutoScientist Challenge 2026, Part 2 | Science Category
75
  **Author:** Hussein Adeiza (mabera) β€” Licensed Environmental Health Officer, Abuja Nigeria
76
- **Model:** Fine-tuned Llama 4 Scout 17B-16E | Powered by Adaptive Data β€” Adaption Labs
77
-
78
- ⚠️ **This dataset addresses an active, serious public health crisis affecting millions of people.**
79
- All interpretation stays measured and analytical, strictly grounded in cited figures.
80
  """)
81
 
82
  with gr.Tabs():
83
  with gr.Tab("🌍 HIV Funding & Response Interpreter"):
84
  gr.Markdown("### Raw HIV funding and epidemiological stats in, structured public health interpretation out")
85
- gr.Markdown("⚠️ Built on real, cited UNAIDS, IAS 2025, Health Policy Watch, and CNBC Africa reporting. All interpretations stay within what the cited source data supports.")
86
  with gr.Row():
87
  with gr.Column():
88
  hiv_example = gr.Dropdown(
@@ -91,7 +157,7 @@ with gr.Blocks(title="Africa HIV Funding AI") as demo:
91
  label="Select a real cited finding"
92
  )
93
  hiv_custom = gr.Textbox(
94
- label="Or paste your own HIV funding/epidemiological stats (demo mode, shows pattern only)",
95
  placeholder="e.g. PrEP use fell from N to N between year and year...",
96
  lines=2
97
  )
@@ -100,16 +166,45 @@ with gr.Blocks(title="Africa HIV Funding AI") as demo:
100
  hiv_output = gr.Markdown()
101
  hiv_btn.click(interpret_hiv_stats, inputs=[hiv_example, hiv_custom], outputs=hiv_output)
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  gr.Markdown("""
104
  ---
105
- ### 🌍 Model β€” Open Source
106
  | Model | Category | Win Rate | Quality | Note |
107
  |-------|----------|----------|---------|------|
108
- | HIV Funding Analysis (Llama 4 Scout 17B-16E) | Science | 71% (60% News-domain) | 6.0β†’6.5, Grade C | Domain classification issue disclosed |
 
109
 
110
- πŸ€— [Model](https://huggingface.co/mabera/africa-hiv-funding-analysis-model) |
111
- πŸ€— [Dataset](https://huggingface.co/datasets/mabera/africa-hiv-funding-dataset) |
112
- πŸ“Š [Kaggle](https://www.kaggle.com/datasets/yunusahusseinadeiza/africa-hiv-funding-disruption-interpreter)
 
113
 
114
  ### Other Portfolio Demos
115
  - Part 1 (Healthcare, Legal, Marketing, Finance, Language): [nigeria-health-ai-demo](https://huggingface.co/spaces/mabera/nigeria-health-ai-demo)
 
1
  import gradio as gr
2
  import spaces
3
 
4
+ # Africa Science AI Demo β€” HIV Funding + AMR Classifier
5
  # AutoScientist Challenge 2026, Part 2 | Science Category
6
  # Author: Hussein Adeiza (mabera) β€” Licensed Environmental Health Officer, Abuja Nigeria
7
 
8
+ # ══════════════════════════════════════════════════════════
9
  # ── HIV Funding & Response Interpreter ──────────────────────
10
+ # ══════════════════════════════════════════════════════════
11
  HIV_EXAMPLES = {
12
  "Regional donor dependency split (West/Central vs East/Southern Africa)": {
13
  "stats": "Donors cover approximately 90 percent of antiretroviral (ARV) drug costs in West and Central Africa, compared to approximately 38 percent in East and Southern Africa. Several high-burden East and Southern African countries are almost entirely dependent on PEPFAR specifically for HIV prevention programs: Malawi at 88.5 percent, Zimbabwe at 82.7 percent, and Mozambique at 81.8 percent. By contrast, South Africa, Botswana, Kenya, and Namibia each rely on PEPFAR for below 25 percent of their prevention funding.",
14
+ "interpretation": "The regional split matters more than the continental average suggests: West and Central Africa's near-total donor dependency for treatment costs (90 percent) means any disruption there would affect ongoing ARV supply directly, while East and Southern Africa's lower regional average for treatment (38 percent) masks enormous country-level variance specifically in prevention funding, where Malawi, Zimbabwe, and Mozambique sit above 80 percent dependency while South Africa, Botswana, Kenya, and Namibia sit below 25 percent. A single continental narrative about 'Africa's HIV response' obscures two fundamentally different risk profiles."
15
  },
16
  "The 2025 PrEP collapse and Nigeria's disproportionate hit": {
17
  "stats": "PrEP use across 62 reporting countries fell from 3.3 million people in 2024 to 2.1 million in 2025, a 38 percent decline, including in Nigeria, Cameroon, and Uganda. In Nigeria specifically, monthly PrEP initiations fell from approximately 40,000 to approximately 6,000 following budget cuts, an 85 percent reduction. Meanwhile, the DREAMS programme, which had targeted 2 million adolescent girls and young women across 10 countries for HIV prevention, halted entirely in all 10 countries.",
18
+ "interpretation": "The gap between the 38 percent multi-country PrEP decline and Nigeria's 85 percent collapse in monthly initiations suggests Nigeria's prevention infrastructure was disproportionately exposed compared to the average reporting country. The complete halt of DREAMS across all 10 countries, rather than a partial reduction, indicates this was a program entirely dependent on a single funding source with no domestic or alternative donor bridge in place."
19
  },
20
  "Mozambique: a real, measured case study": {
21
  "stats": "In Mozambique, where PEPFAR has funded roughly two-thirds of the national HIV program for over a decade, comparing February to May 2025 against the same period in 2024 shows more than 15,000 fewer people started antiretroviral treatment, a 14 percent reduction. Viral load testing fell 38 percent in adults and 44 percent in children, while viral suppression rates among those tested fell 33 percent in adults and 43 percent in children.",
22
+ "interpretation": "The consistent pattern of children being harder hit than adults across both viral load testing and viral suppression suggests pediatric HIV services in Mozambique were more concentrated in the disrupted funding stream than adult services. This four-month snapshot from a single country provides a concrete, measured example of what larger continental modeling projections describe in the abstract."
23
  },
24
  "2030 modeling: why treatment funding matters as much as prevention": {
25
+ "stats": "Modeling presented at the 2025 International AIDS Society Conference projected two scenarios through 2030. A moderate scenario, with prevention and testing funding cut by 24 percent by 2026 but treatment sustained by domestic funding, would result in 71,500 to 1.7 million additional new HIV infections. A severe scenario, adding full PEPFAR discontinuation, would result in 4.4 million to 10.8 million additional new infections.",
26
+ "interpretation": "The roughly 6-fold jump in the upper-bound infection estimate between the moderate and severe scenarios is not proportional to the funding change, since the severe scenario only adds full PEPFAR discontinuation on top of the same prevention cuts. This indicates that treatment funding, not just prevention funding, plays an outsized protective role against new infections."
27
  },
28
  "The resilience counter-narrative: treatment held, prevention didn't": {
29
+ "stats": "Despite the 2025 funding disruptions, the number of people on antiretroviral treatment globally rose 2.7 percent year-on-year to 32.1 million by December 2025, though below the roughly 4 percent historical average. Domestic funding's share of total HIV resources in low and middle-income countries rose to approximately 52 percent in 2024, up from 28 percent in 2010.",
30
+ "interpretation": "The continued growth in treatment numbers despite the funding shock indicates the treatment system had more built-in resilience than the prevention system. Domestic funding growth, while a genuine long-term positive trend, is not currently happening at a scale capable of substituting for the 2025 funding shock."
31
  },
32
  }
33
 
 
36
  if custom_stats and custom_stats.strip():
37
  return f"""
38
  ## 🌍 HIV Funding & Response Interpretation
 
39
  **Input stats:** {custom_stats}
40
+ **Note:** This is a demo using pre-built reference interpretations. Try a dropdown example for a real cited interpretation.
 
 
 
 
41
  ---
42
  *Africa HIV Funding Analysis Model β€” Fine-tuned Llama 4 Scout 17B-16E | AutoScientist 2026 Part 2*
43
  """
44
  example = HIV_EXAMPLES.get(selected_example, list(HIV_EXAMPLES.values())[0])
45
  return f"""
46
  ## 🌍 HIV Funding & Response Interpretation
 
47
  **Raw cited statistics (input):**
48
  {example['stats']}
 
49
  **Structured public health interpretation (output):**
50
  {example['interpretation']}
 
51
  ---
 
 
 
 
 
52
  ### ⚠️ Important Disclosure
53
+ This dataset was intended for Science but the platform's classifier tagged it News/Governance, routing training to Llama 4 Scout 17B-16E rather than Llama 3.3 70B. Reported to Adaption before publishing. Win rate 71% on dataset, 60% General Win Rate (News-domain benchmark). Full disclosure in the model card.
54
 
55
  *Africa HIV Funding Analysis Model β€” Fine-tuned Llama 4 Scout 17B-16E | AutoScientist 2026 | Science Category*
56
  *Powered by Adaptive Data β€” Adaption Labs*
57
  """
58
 
59
+ # ══════════════════════════════════════════════════════════
60
+ # ── AMR Closed-Label Classifier ──────────────────────────────
61
+ # ══════════════════════════════════════════════════════════
62
+ BREAKPOINTS = {
63
+ "Enterobacterales / Ampicillin": {"s_max": 8, "i_val": 16, "r_min": 32},
64
+ "Enterobacterales / Ceftriaxone": {"s_max": 1, "i_val": 2, "r_min": 4},
65
+ "Enterobacterales / Ciprofloxacin": {"s_max": 0.25, "i_val": 0.5, "r_min": 1},
66
+ "Enterobacterales / Meropenem": {"s_max": 1, "i_val": 2, "r_min": 4},
67
+ "Enterobacterales / Gentamicin": {"s_max": 4, "i_val": 8, "r_min": 16},
68
+ "Staphylococcus aureus / Oxacillin (MRSA screen)": {"s_max": 2, "i_val": None, "r_min": 4},
69
+ "Enterobacterales / Colistin (no S category)": {"s_max": None, "i_val": 2, "r_min": 4},
70
+ }
71
+
72
+ @spaces.GPU
73
+ def classify_mic(organism_antibiotic, mic_value):
74
+ bp = BREAKPOINTS.get(organism_antibiotic)
75
+ if bp is None or mic_value is None:
76
+ return "Please select a valid organism/antibiotic combination and enter a MIC value."
77
+
78
+ mic = float(mic_value)
79
+ if bp["s_max"] is not None and mic <= bp["s_max"]:
80
+ result, color = "Susceptible", "🟒"
81
+ elif bp["r_min"] is not None and mic >= bp["r_min"]:
82
+ result, color = "Resistant", "πŸ”΄"
83
+ else:
84
+ result, color = "Intermediate", "🟑"
85
+
86
+ s_str = f"≀{bp['s_max']}" if bp["s_max"] is not None else "none (no S category)"
87
+ i_str = f"{bp['i_val']}" if bp["i_val"] is not None else "none (no I category)"
88
+ r_str = f"β‰₯{bp['r_min']}" if bp["r_min"] is not None else "n/a"
89
+
90
+ return f"""
91
+ ## {color} Classification: {result}
92
+
93
+ **Your input:** {organism_antibiotic}, MIC = {mic} ug/mL
94
+
95
+ **CLSI M100 (2025) breakpoints applied:**
96
+ - Susceptible: {s_str}
97
+ - Intermediate: {i_str}
98
+ - Resistant: {r_str}
99
+
100
+ This classification was computed live from your input against the real CLSI breakpoint registry, the same deterministic logic used to build and verify every row in the training dataset.
101
+
102
+ ---
103
+ *Nigeria AMR Classifier v2 β€” Fine-tuned Llama 3.3 70B | AutoScientist 2026 | Science Category*
104
+ """
105
+
106
+ @spaces.GPU
107
+ def classify_rate(n_tested, n_nonsusceptible):
108
+ if not n_tested or n_tested <= 0:
109
+ return "Please enter a valid number of isolates tested (must be greater than 0)."
110
+ if n_nonsusceptible is None or n_nonsusceptible < 0:
111
+ return "Please enter a valid number of non-susceptible isolates."
112
+ if n_nonsusceptible > n_tested:
113
+ return "Non-susceptible count cannot exceed the number tested."
114
+
115
+ rate = round((n_nonsusceptible / n_tested) * 100, 1)
116
+ if rate < 20:
117
+ level, color = "Low", "🟒"
118
+ elif rate <= 50:
119
+ level, color = "Moderate", "🟑"
120
+ else:
121
+ level, color = "High", "πŸ”΄"
122
+
123
+ return f"""
124
+ ## {color} Resistance Rate: {rate}% β€” {level} Resistance
125
+
126
+ **Calculation:** {int(n_nonsusceptible)} / {int(n_tested)} isolates Γ— 100 = {rate}%
127
+
128
+ **Classification thresholds:** Low (<20%), Moderate (20-50%), High (>50%)
129
+
130
+ This is the exact calculation method used to build and verify all 28 national surveillance rows in the training dataset, each independently recomputed against Nigeria's real MAAP/Fleming Fund surveillance report.
131
+
132
+ ---
133
+ *Nigeria AMR Classifier v2 β€” Fine-tuned Llama 3.3 70B | AutoScientist 2026 | Science Category*
134
+ """
135
+
136
+ # ══════════════════════════════════════════════════════════
137
  # ── Build Interface ─────────────────────────────────────────
138
+ # ══════════════════════════════════════════════════════════
139
+ with gr.Blocks(title="Africa Science AI") as demo:
140
  gr.Markdown("""
141
+ # 🌍🧫 Africa Science AI Demo
142
  ## AutoScientist Challenge 2026, Part 2 | Science Category
143
  **Author:** Hussein Adeiza (mabera) β€” Licensed Environmental Health Officer, Abuja Nigeria
144
+ **Two models:** HIV Funding Analysis (Llama 4 Scout) + AMR Classifier v2 (Llama 3.3 70B)
145
+ **Powered by Adaptive Data β€” Adaption Labs**
 
 
146
  """)
147
 
148
  with gr.Tabs():
149
  with gr.Tab("🌍 HIV Funding & Response Interpreter"):
150
  gr.Markdown("### Raw HIV funding and epidemiological stats in, structured public health interpretation out")
151
+ gr.Markdown("⚠️ Built on real, cited UNAIDS, IAS 2025, Health Policy Watch, and CNBC Africa reporting.")
152
  with gr.Row():
153
  with gr.Column():
154
  hiv_example = gr.Dropdown(
 
157
  label="Select a real cited finding"
158
  )
159
  hiv_custom = gr.Textbox(
160
+ label="Or paste your own HIV funding/epidemiological stats (demo mode)",
161
  placeholder="e.g. PrEP use fell from N to N between year and year...",
162
  lines=2
163
  )
 
166
  hiv_output = gr.Markdown()
167
  hiv_btn.click(interpret_hiv_stats, inputs=[hiv_example, hiv_custom], outputs=hiv_output)
168
 
169
+ with gr.Tab("πŸ§ͺ AMR: MIC β†’ Susceptibility Classification"):
170
+ gr.Markdown("### Enter a real MIC value and see the CLSI-based classification computed live")
171
+ gr.Markdown("⚠️ Closed-label classification: results are deterministically computed, not generated.")
172
+ with gr.Row():
173
+ with gr.Column():
174
+ mic_organism = gr.Dropdown(
175
+ choices=list(BREAKPOINTS.keys()),
176
+ value=list(BREAKPOINTS.keys())[0],
177
+ label="Organism / Antibiotic"
178
+ )
179
+ mic_value = gr.Number(label="Measured MIC (ug/mL)", value=0.5, precision=3)
180
+ mic_btn = gr.Button("πŸ§ͺ Classify", variant="primary")
181
+ with gr.Column():
182
+ mic_output = gr.Markdown()
183
+ mic_btn.click(classify_mic, inputs=[mic_organism, mic_value], outputs=mic_output)
184
+
185
+ with gr.Tab("πŸ“Š AMR: Surveillance Rate Classification"):
186
+ gr.Markdown("### Enter isolate counts and see the resistance rate computed live")
187
+ with gr.Row():
188
+ with gr.Column():
189
+ n_tested = gr.Number(label="Isolates tested (N)", value=2528, precision=0)
190
+ n_nonsusceptible = gr.Number(label="Non-susceptible isolates (n)", value=1766, precision=0)
191
+ rate_btn = gr.Button("πŸ“Š Calculate Rate", variant="primary")
192
+ with gr.Column():
193
+ rate_output = gr.Markdown()
194
+ rate_btn.click(classify_rate, inputs=[n_tested, n_nonsusceptible], outputs=rate_output)
195
+
196
  gr.Markdown("""
197
  ---
198
+ ### Models β€” Open Source
199
  | Model | Category | Win Rate | Quality | Note |
200
  |-------|----------|----------|---------|------|
201
+ | HIV Funding Analysis (Llama 4 Scout) | Science | 71% (60% general) | 6.0β†’6.5, Grade C | Domain classification issue disclosed |
202
+ | AMR Classifier v2 (Llama 3.3 70B) | Science | 58% (71% general) | 8.0β†’8.7, Grade B | 34/34 rows verified |
203
 
204
+ πŸ€— [HIV Model](https://huggingface.co/mabera/africa-hiv-funding-analysis-model) |
205
+ πŸ€— [AMR Model](https://huggingface.co/mabera/nigeria-amr-classifier-v2) |
206
+ πŸ€— [HIV Dataset](https://huggingface.co/datasets/mabera/africa-hiv-funding-dataset) |
207
+ πŸ€— [AMR Dataset](https://huggingface.co/datasets/mabera/nigeria-amr-classifier-v2-dataset)
208
 
209
  ### Other Portfolio Demos
210
  - Part 1 (Healthcare, Legal, Marketing, Finance, Language): [nigeria-health-ai-demo](https://huggingface.co/spaces/mabera/nigeria-health-ai-demo)