AskOscar.herbal.ai / index.html
Askoscar's picture
Upload 5 files
b55a14c verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AskOscar Herbal AI 🌿</title>
<style>
body {
font-family: "Garamond", serif;
background-image: url("c46cfe98-a47f-4596-a93b-ea93bb8806f3.jpg");
background-size: cover;
background-position: center;
color: #fff;
text-align: center;
height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
justify-content: center;
backdrop-filter: brightness(0.4);
}
h1 {
font-size: 2.5em;
margin-bottom: 10px;
text-shadow: 2px 2px 5px #000;
}
p {
margin-top: 0;
font-size: 1.2em;
text-shadow: 1px 1px 3px #000;
}
.container {
background-color: rgba(0, 0, 0, 0.6);
border-radius: 20px;
padding: 30px;
max-width: 650px;
margin: 0 auto;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
display: flex;
flex-direction: column;
align-items: center;
height: 80vh;
}
#chat-box {
background-color: rgba(255, 255, 255, 0.1);
border-radius: 10px;
padding: 15px;
width: 100%;
height: 65%;
overflow-y: auto;
text-align: left;
margin-bottom: 15px;
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}
.message {
margin-bottom: 15px;
line-height: 1.4em;
}
.user {
text-align: right;
color: #aef7c7;
}
.bot {
text-align: left;
color: #fffbe6;
}
.input-container {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
input {
width: 70%;
padding: 12px;
border: none;
border-radius: 10px;
font-size: 1em;
margin-top: 10px;
}
button {
background-color: #00b894;
border: none;
border-radius: 10px;
padding: 12px 20px;
font-size: 1em;
color: white;
cursor: pointer;
margin-left: 10px;
transition: background 0.3s ease;
}
button:hover {
background-color: #019870;
}
.top-buttons {
position: absolute;
top: 15px;
right: 15px;
display: flex;
gap: 10px;
z-index: 1000;
}
.top-buttons button {
background-color: #019870;
border-radius: 8px;
padding: 8px 14px;
font-size: 0.9em;
}
footer {
position: absolute;
bottom: 10px;
width: 100%;
text-align: center;
font-size: 0.9em;
color: #ccc;
}
/* Modal Styling */
.modal {
display: none;
position: fixed;
z-index: 999;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.8);
}
.modal-content {
background-color: #222;
margin: 15% auto;
padding: 20px;
border-radius: 10px;
width: 80%;
max-width: 500px;
text-align: left;
color: #eee;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
}
.close {
color: #aaa;
float: right;
font-size: 22px;
cursor: pointer;
}
.close:hover {
color: white;
}
</style>
</head>
<body>
<div class="top-buttons">
<button id="aboutBtn">About</button>
<button id="donateBtn">Donate</button>
</div>
<div class="container">
<h1>🌿 AskOscar Herbal AI 🌿</h1>
<p>Ask me anything about medicinal plants, healing herbs, or natural remedies.</p>
<div id="chat-box"></div>
<div class="input-container">
<input id="userInput" placeholder="Ask about any medicinal plant..." />
<button id="askButton">Send</button>
</div>
</div>
<footer>Powered by Hugging Face β€’ Herbal Wisdom by Oscar</footer>
<!-- About Modal -->
<div id="aboutModal" class="modal">
<div class="modal-content">
<span class="close" id="closeAbout">&times;</span>
<h2>About Oscar Teye</h2>
<p>
Oscar Teye is the visionary founder of <strong>AskOscar.ai</strong> β€” a digital herbal intelligence
created to reconnect humanity with the healing power of nature.
Born with a passion for natural medicine and innovation, Oscar blends African herbal wisdom with
artificial intelligence to make herbal knowledge accessible, practical, and inspiring for all.
</p>
</div>
</div>
<!-- Donate Modal -->
<div id="donateModal" class="modal">
<div class="modal-content">
<span class="close" id="closeDonate">&times;</span>
<h2>Support AskOscar.ai</h2>
<p>
🌿 Every seed of support helps this herbal AI grow stronger!
If you believe in natural healing and want to keep AskOscar.ai running,
you can support through donations.
</p>
<p><strong>Ways to Support:</strong></p>
<ul>
<li>Mobile Money: +233 XXX XXX XXX</li>
<li>PayPal: coming soon</li>
<li>Share the website with friends 🌍</li>
</ul>
<p>Thank you for helping sustain a greener, wiser future 🌱</p>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", () => {
const API_URL = "https://api-inference.huggingface.co/models/google/gemma-2b-it";
const HF_TOKEN = "hf_your_token_here"; // Replace with your actual Hugging Face token
async function askOscarAI(question) {
const herbalWords = ["plant", "herb", "leaves", "roots", "bark", "healing", "natural", "disease", "dosage", "scientific name"];
const isHerbal = herbalWords.some(word => question.toLowerCase().includes(word));
if (!isHerbal) {
return "πŸƒ Sorry, I only answer questions about medicinal plants, natural healing, and herbal remedies.";
}
const prompt = `
You are AskOscar Herbal AI β€” an expert in natural and traditional medicine.
Respond like a warm, intelligent herbalist from Ghana, giving scientific names, local names, healing uses, dosage, and any cultural facts.
User's question: ${question}
`;
try {
const response = await fetch(API_URL, {
method: "POST",
headers: {
"Authorization": \`Bearer \${HF_TOKEN}\`,
"Content-Type": "application/json",
},
body: JSON.stringify({ inputs: prompt }),
});
const result = await response.json();
if (result.error) return "🌿 The herbal spirits are resting... please try again soon.";
return result[0]?.generated_text || "No response received.";
} catch (error) {
console.error(error);
return "⚠️ Unable to connect to the herbal network. Check your internet or token.";
}
}
const chatBox = document.getElementById("chat-box");
const input = document.getElementById("userInput");
const sendBtn = document.getElementById("askButton");
sendBtn.addEventListener("click", async () => {
const question = input.value.trim();
if (!question) return;
const userMsg = document.createElement("div");
userMsg.classList.add("message", "user");
userMsg.textContent = "🧍 " + question;
chatBox.appendChild(userMsg);
const botMsg = document.createElement("div");
botMsg.classList.add("message", "bot");
botMsg.textContent = "🌿 Thinking...";
chatBox.appendChild(botMsg);
chatBox.scrollTop = chatBox.scrollHeight;
input.value = "";
const answer = await askOscarAI(question);
botMsg.textContent = "πŸͺ΄ " + answer;
chatBox.scrollTop = chatBox.scrollHeight;
});
// Handle modals
const aboutModal = document.getElementById("aboutModal");
const donateModal = document.getElementById("donateModal");
const aboutBtn = document.getElementById("aboutBtn");
const donateBtn = document.getElementById("donateBtn");
const closeAbout = document.getElementById("closeAbout");
const closeDonate = document.getElementById("closeDonate");
aboutBtn.onclick = () => (aboutModal.style.display = "block");
donateBtn.onclick = () => (donateModal.style.display = "block");
closeAbout.onclick = () => (aboutModal.style.display = "none");
closeDonate.onclick = () => (donateModal.style.display = "none");
window.onclick = (event) => {
if (event.target === aboutModal) aboutModal.style.display = "none";
if (event.target === donateModal) donateModal.style.display = "none";
};
});
</script>
</body>
</html>