danosethrus commited on
Commit
240b3c8
·
verified ·
1 Parent(s): afce516

index.html

Browse files
Files changed (1) hide show
  1. index.html +74 -0
index.html ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>EthioDocs Medical AI</title>
5
+ <style>
6
+ body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; max-width: 800px; margin: 40px auto; padding: 20px; background-color: #f0f2f5; }
7
+ .container { background: white; padding: 30px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
8
+ h1 { color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px; }
9
+ #input { width: 100%; height: 120px; padding: 15px; border: 2px solid #ddd; border-radius: 10px; font-size: 16px; margin: 15px 0; box-sizing: border-box; }
10
+ #status { color: #7f8c8d; font-style: italic; margin-bottom: 10px; }
11
+ button { background: #3498db; color: white; border: none; padding: 12px 25px; cursor: pointer; border-radius: 8px; font-weight: bold; transition: 0.3s; }
12
+ button:hover { background: #2980b9; }
13
+ button:disabled { background: #bdc3c7; cursor: not-allowed; }
14
+ #result { background: #ecf0f1; padding: 20px; border-radius: 10px; margin-top: 20px; white-space: pre-wrap; color: #2c3e50; border-left: 6px solid #3498db; }
15
+ </style>
16
+ </head>
17
+ <body>
18
+ <div class="container">
19
+ <h1>🏥 EthioDocs Medical Assistant</h1>
20
+ <p>A Grade 10 AI Project by Daniel (WebGPU Powered)</p>
21
+
22
+ <div id="status">Status: Waiting to initialize...</div>
23
+ <button id="init-btn">Start Medical Engine</button>
24
+
25
+ <hr>
26
+
27
+ <textarea id="input" placeholder="Example: I have a persistent cough and a fever of 38°C. What should I do?"></textarea>
28
+ <button id="send-btn" disabled>Get Medical Advice</button>
29
+
30
+ <div id="result">The diagnosis will appear here after initialization.</div>
31
+ </div>
32
+
33
+ <script type="module">
34
+ import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.0';
35
+
36
+ let generator;
37
+ const status = document.getElementById('status');
38
+ const initBtn = document.getElementById('init-btn');
39
+ const sendBtn = document.getElementById('send-btn');
40
+
41
+ initBtn.onclick = async () => {
42
+ initBtn.disabled = true;
43
+ status.innerText = "Status: Downloading Model (4.5GB)... This may take 2-5 minutes.";
44
+
45
+ try {
46
+ // CALLING YOUR SPECIFIC MODEL
47
+ generator = await pipeline('text-generation', 'danosethrus/Medical-Qwen-2B-Ethiopia', {
48
+ device: 'webgpu',
49
+ });
50
+ status.innerText = "Status: ✅ Ready! Model running on your local GPU.";
51
+ sendBtn.disabled = false;
52
+ } catch (err) {
53
+ status.innerText = "Status: ❌ Error. Make sure you're using Chrome/Edge and have WebGPU enabled.";
54
+ console.error(err);
55
+ }
56
+ };
57
+
58
+ sendBtn.onclick = async () => {
59
+ const text = document.getElementById('input').value;
60
+ if(!text) return;
61
+
62
+ status.innerText = "Status: AI is diagnosing...";
63
+ const output = await generator(text, {
64
+ max_new_tokens: 256,
65
+ temperature: 0.7,
66
+ do_sample: true
67
+ });
68
+
69
+ document.getElementById('result').innerText = output[0].generated_text;
70
+ status.innerText = "Status: ✅ Ready.";
71
+ };
72
+ </script>
73
+ </body>
74
+ </html>