elimuhub_bot / app.py
elimuhub's picture
Update app.py
104553e verified
raw
history blame
4.24 kB
import gradio as gr
import random
# Knowledge base with all Elimuhub information
services = {
"greeting": [
"Hello! Welcome to Elimuhub Education Consultants! πŸŽ“ How can I assist you today?",
"Hi there! Welcome to Elimuhub. Ask me about homeschooling, subjects, curriculum, or fees!",
"Greetings! Thank you for contacting Elimuhub Education Consultants."
],
"homeschooling": """**Our Homeschooling Services** πŸ“š
We provide comprehensive support for families seeking alternative education:
β€’ **Customized Learning Plans**: Tailored to your child's needs and goals
β€’ **Flexible Scheduling**: Adapts to your family's routine
β€’ **Full-Time or Part-Time**: Complete education or supplementary support
β€’ **Experienced Tutors**: Qualified educators in their fields
β€’ **Exam Preparation**: KCPE, KCSE, IGCSE preparation
*Would you like details about any specific aspect?*""",
"subjects": """**Subjects We Offer** πŸ“–
**Primary & Secondary Level:**
- Mathematics, Sciences (Biology, Chemistry, Physics)
- English, Kiswahili, History, Geography
- CRE, Business Studies, Agriculture, Computer Studies
**International Curricula (IGCSE & IB):**
- Mathematics, Sciences, English, Business Studies
- Languages (French, German, Spanish, Italian, Chinese)
- Humanities (History, Geography)
**Other:** Adult Education and Professional Training""",
"curriculum": """**Curricula We Teach** 🌍
**Kenyan System:**
- Competency-Based Curriculum (CBC)
- 8-4-4 System (KCPE & KCSE)
**International Systems:**
- British Curriculum (IGCSE & A-Levels)
- International Baccalaureate (IB)
- American K-12 Curriculum
**Adult Education:** Lifelong learning and retake support""",
"fees": """**Our Fee Structure** πŸ’°
*Fees are negotiable with flexible payment options*
**Tuition Packages:**
- 1-on-1: KES 1,500 - 3,000/hour
- Group: KES 800 - 1,500/session (max 10 students)
- Monthly: KES 15,000 - 30,000/month
- Holiday: From KES 2,000/session
- Online: 20% discount on in-person rates
**Homeschooling:**
- Full-Time: KES 30,000 - 50,000+/month
- Part-Time: KES 700 - 900+/hour
- Sibling discounts available
*Free 15-minute consultation available!*""",
"contact": """**Contact Elimuhub** πŸ“ž
**WhatsApp:** +254 731 838 387
We offer a **FREE 15-minute consultation** to discuss your educational needs!
*Best time to reach us: 8:00 AM - 6:00 PM daily*"""
}
def respond(message, history):
message_lower = message.lower()
# Greeting
if any(word in message_lower for word in ["hi", "hello", "hey", "good morning", "good afternoon"]):
return random.choice(services["greeting"])
# Homeschooling
elif any(word in message_lower for word in ["homeschool", "home school", "home schooling"]):
return services["homeschooling"]
# Subjects
elif any(word in message_lower for word in ["subject", "teach", "course", "what do you offer"]):
return services["subjects"]
# Curriculum
elif any(word in message_lower for word in ["curriculum", "syllabus", "system", "what curriculum"]):
return services["curriculum"]
# Pricing
elif any(word in message_lower for word in ["price", "fee", "cost", "how much", "payment"]):
return services["fees"]
# Contact
elif any(word in message_lower for word in ["contact", "whatsapp", "phone", "number", "talk", "consultation"]):
return services["contact"]
# Default response
else:
return "I'm here to help with Elimuhub's educational services! You can ask me about:\n\nβ€’ Homeschooling programs\nβ€’ Subjects we teach\nβ€’ Curriculum information\nβ€’ Fee structures\nβ€’ Contact details\n\nWhat would you like to know?"
# Create the chatbot interface
demo = gr.ChatInterface(
respond,
title="πŸŽ“ Elimuhub Education Consultants",
description="Ask about our personalized tuition & homeschooling services!",
examples=[
["Tell me about homeschooling"],
["Which subjects do you offer?"],
["What curriculum do you teach?"],
["What are your fees?"],
["How can I contact you?"]
],
theme="soft"
)
if __name__ == "__main__":
demo.launch()