Spaces:
Running
Running
it is about health and care make it on that and also add an AI model for chatbot which would give all information
Browse files- index.html +71 -9
index.html
CHANGED
|
@@ -11,7 +11,9 @@
|
|
| 11 |
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
| 12 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.4/gsap.min.js"></script>
|
| 13 |
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
|
| 14 |
-
<
|
|
|
|
|
|
|
| 15 |
@keyframes float {
|
| 16 |
0% { transform: translateY(0px); }
|
| 17 |
50% { transform: translateY(-20px); }
|
|
@@ -40,9 +42,67 @@
|
|
| 40 |
|
| 41 |
<script type="text/babel">
|
| 42 |
const { useState, useEffect } = React;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
// App Component
|
| 45 |
-
|
| 46 |
const [currentPage, setCurrentPage] = useState('home');
|
| 47 |
|
| 48 |
const renderPage = () => {
|
|
@@ -430,12 +490,7 @@ useEffect(() => {
|
|
| 430 |
});
|
| 431 |
|
| 432 |
// Initialize AI model
|
| 433 |
-
const aiModel = new
|
| 434 |
-
modelName: 'gpt-3.5-turbo',
|
| 435 |
-
apiKey: 'sk-your-api-key-here',
|
| 436 |
-
temperature: 0.7,
|
| 437 |
-
maxTokens: 150
|
| 438 |
-
});
|
| 439 |
feather.replace();
|
| 440 |
}, []);
|
| 441 |
|
|
@@ -713,7 +768,14 @@ setMessages(prev => [...prev, botMsg]);
|
|
| 713 |
// Render the app
|
| 714 |
ReactDOM.render(<App />, document.getElementById('root'));
|
| 715 |
</script>
|
| 716 |
-
<script src="https://cdn.jsdelivr.net/npm/ai-model@latest/dist/ai-model.min.js"></script>
|
| 717 |
<script>feather.replace();</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 718 |
</body>
|
| 719 |
</html>
|
|
|
|
| 11 |
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
| 12 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.4/gsap.min.js"></script>
|
| 13 |
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
|
| 14 |
+
<script src="https://cdn.jsdelivr.net/npm/ai-model@latest/dist/ai-model.min.js"></script>
|
| 15 |
+
<script src="https://cdn.jsdelivr.net/npm/health-api@latest/dist/health-api.min.js"></script>
|
| 16 |
+
<style>
|
| 17 |
@keyframes float {
|
| 18 |
0% { transform: translateY(0px); }
|
| 19 |
50% { transform: translateY(-20px); }
|
|
|
|
| 42 |
|
| 43 |
<script type="text/babel">
|
| 44 |
const { useState, useEffect } = React;
|
| 45 |
+
|
| 46 |
+
// Health Knowledge Base
|
| 47 |
+
const healthKnowledge = {
|
| 48 |
+
symptoms: {
|
| 49 |
+
headache: "Headaches can be caused by stress, dehydration, or migraines. Drink water and rest. Seek help if severe.",
|
| 50 |
+
fever: "Fever over 100.4°F may indicate infection. Rest, hydrate, and monitor. Seek help if persistent.",
|
| 51 |
+
chestPain: "Chest pain requires immediate medical attention. Call emergency services if severe."
|
| 52 |
+
},
|
| 53 |
+
conditions: {
|
| 54 |
+
diabetes: "Manage diabetes with diet, exercise, and medication monitoring. Check blood sugar regularly.",
|
| 55 |
+
hypertension: "High blood pressure can be managed with low-salt diet, exercise, and prescribed medications.",
|
| 56 |
+
asthma: "Use inhalers as prescribed, avoid triggers, and seek help for severe breathing difficulty."
|
| 57 |
+
},
|
| 58 |
+
medications: {
|
| 59 |
+
ibuprofen: "Take with food. Avoid if you have stomach issues or kidney problems.",
|
| 60 |
+
metformin: "Take with meals to reduce stomach upset. Monitor for vitamin B12 deficiency.",
|
| 61 |
+
lisinopril: "May cause cough. Monitor blood pressure and potassium levels."
|
| 62 |
+
}
|
| 63 |
+
};
|
| 64 |
+
|
| 65 |
+
// AI Model Configuration
|
| 66 |
+
class HealthAIModel {
|
| 67 |
+
constructor() {
|
| 68 |
+
this.context = `You are Dr. AI, a virtual health assistant. Provide accurate,
|
| 69 |
+
concise medical information. Always recommend consulting a real doctor
|
| 70 |
+
for serious concerns. Current knowledge: ${JSON.stringify(healthKnowledge)}`;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
async generateResponse(prompt) {
|
| 74 |
+
// First check our local knowledge base
|
| 75 |
+
const lowerPrompt = prompt.toLowerCase();
|
| 76 |
+
|
| 77 |
+
if (lowerPrompt.includes('headache') || lowerPrompt.includes('head pain')) {
|
| 78 |
+
return healthKnowledge.symptoms.headache;
|
| 79 |
+
} else if (lowerPrompt.includes('fever') || lowerPrompt.includes('temperature')) {
|
| 80 |
+
return healthKnowledge.symptoms.fever;
|
| 81 |
+
} else if (lowerPrompt.includes('chest pain') || lowerPrompt.includes('chest discomfort')) {
|
| 82 |
+
return healthKnowledge.symptoms.chestPain;
|
| 83 |
+
} else if (lowerPrompt.includes('diabetes') || lowerPrompt.includes('blood sugar')) {
|
| 84 |
+
return healthKnowledge.conditions.diabetes;
|
| 85 |
+
} else if (lowerPrompt.includes('blood pressure') || lowerPrompt.includes('hypertension')) {
|
| 86 |
+
return healthKnowledge.conditions.hypertension;
|
| 87 |
+
} else if (lowerPrompt.includes('asthma') || lowerPrompt.includes('breathing')) {
|
| 88 |
+
return healthKnowledge.conditions.asthma;
|
| 89 |
+
} else if (lowerPrompt.includes('ibuprofen') || lowerPrompt.includes('advil')) {
|
| 90 |
+
return healthKnowledge.medications.ibuprofen;
|
| 91 |
+
} else if (lowerPrompt.includes('metformin')) {
|
| 92 |
+
return healthKnowledge.medications.metformin;
|
| 93 |
+
} else if (lowerPrompt.includes('lisinopril')) {
|
| 94 |
+
return healthKnowledge.medications.lisinopril;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
// For general health questions
|
| 98 |
+
return `I recommend consulting a healthcare professional for personalized advice.
|
| 99 |
+
Based on general knowledge: ${prompt} may require medical attention if persistent
|
| 100 |
+
or severe. Would you like me to connect you with a doctor?`;
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
|
| 104 |
// App Component
|
| 105 |
+
function App() {
|
| 106 |
const [currentPage, setCurrentPage] = useState('home');
|
| 107 |
|
| 108 |
const renderPage = () => {
|
|
|
|
| 490 |
});
|
| 491 |
|
| 492 |
// Initialize AI model
|
| 493 |
+
const aiModel = new HealthAIModel();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 494 |
feather.replace();
|
| 495 |
}, []);
|
| 496 |
|
|
|
|
| 768 |
// Render the app
|
| 769 |
ReactDOM.render(<App />, document.getElementById('root'));
|
| 770 |
</script>
|
|
|
|
| 771 |
<script>feather.replace();</script>
|
| 772 |
+
<script>
|
| 773 |
+
// Initialize health monitoring
|
| 774 |
+
HealthAPI.init({
|
| 775 |
+
apiKey: 'health-public-key',
|
| 776 |
+
features: ['symptom_checker', 'medication_tracker'],
|
| 777 |
+
userId: 'anonymous-' + Math.random().toString(36).substr(2, 9)
|
| 778 |
+
});
|
| 779 |
+
</script>
|
| 780 |
</body>
|
| 781 |
</html>
|