vinaymodel / teach_me.py
hackerbhai's picture
🎯 EKALAVYA v3.0 - Added emojis and icons everywhere!
0b0b4c4 verified
Raw
History Blame Contribute Delete
7.3 kB
#!/usr/bin/env python3
"""
🎯 EKALAVYA - Interactive Teaching Demo
🎓 Learn English with AI • 💝 Friendly Conversations • 🧠 Memory-Powered
"""
from model.teaching import TeachingMode
from model.safety import SafetyRules
def print_header():
"""🎨 Print beautiful header"""
print("""
╔═══════════════════════════════════════════════════════════╗
║ ║
║ 🎯 EKALAVYA - AI Teaching Assistant ║
║ ║
║ 🎓 Interactive Teaching Mode ║
║ ║
║ 💝 Choose Your Style: ║
║ 👫 Friend • 👨‍🏫 Teacher • 💕 Lover • 🎓 Mentor ║
║ ║
╚═══════════════════════════════════════════════════════════╝
""")
def get_user_choice(prompt, options):
"""🎯 Get user choice with emojis"""
print(f"\n{prompt}")
for i, (key, value) in enumerate(options.items(), 1):
print(f" {i}. {value}")
while True:
try:
choice = int(input("\n👉 Enter your choice (1-{}): ".format(len(options))))
if 1 <= choice <= len(options):
return list(options.keys())[choice - 1]
print("❌ Invalid choice, try again!")
except ValueError:
print("❌ Please enter a number!")
def demo_teaching_mode():
"""🎓 Run interactive teaching demo"""
print_header()
# 🎯 Choose conversation style
styles = {
"friend": "👫 Friend - Casual and supportive",
"teacher": "👨‍🏫 Teacher - Formal and educational",
"lover": "💕 Lover - Caring and affectionate",
"mentor": "🎓 Mentor - Wise and guiding"
}
print("\n💝 Choose your conversation style:")
style = get_user_choice("💝 Select style:", styles)
# 🌍 Choose language
languages = {
"english": "🇬🇧 English",
"hindi": "🇮🇳 Hindi (हिंदी)",
"bengali": "🇮🇳 Bengali (বাংলা)"
}
print("\n🌍 Choose your language:")
language = get_user_choice("🌍 Select language:", languages)
# 🎯 Initialize teaching mode
teaching = TeachingMode(style=style)
safety = SafetyRules()
print(f"\n✨ Great! Now talking as your {style} in {language}!")
print(f"📝 Write sentences and I'll help you improve!")
print(f"🛡️ Your learning is 100% private and safe!")
print("\n" + "═" * 60)
# 🎓 Interactive session
session_active = True
sentence_count = 0
while session_active:
print("\n📝 Write a sentence (or type 'quit' to exit):")
user_input = input("👉 ").strip()
# 🚪 Exit condition
if user_input.lower() in ['quit', 'exit', 'q']:
print("\n👋 Thank you for learning with EKALAVYA!")
print("🌟 Keep practicing and you'll improve!")
break
# 🛡️ Safety check
safety_result = safety.check_content(user_input)
if not safety_result['is_safe']:
print(f"\n⚠️ {safety_result['warnings'][0]}")
continue
# 🎯 Process teaching request
sentence_count += 1
result = teaching.process_teaching_request(
user_input=user_input,
conversation_style=style,
language=language
)
# 📊 Display results
print("\n" + "─" * 60)
# 💬 Response
print(f"\n💬 Response:\n{result['response']}")
# 🔍 Mistakes found
if result['mistakes']:
print(f"\n🔍 Found {len(result['mistakes'])} mistake(s):")
for mistake in result['mistakes']:
print(f" ❌ {mistake['original']}")
else:
print(f"\n✨ Perfect! No mistakes found!")
# ✅ Corrections
if result['corrections']:
print(f"\n✅ Corrections:")
for correction in result['corrections']:
print(f" ✓ {correction['original']}{correction['corrected']}")
# 📚 Explanation
if result['explanation']:
print(f"\n📚 Explanation:\n{result['explanation']}")
# 💝 Encouragement
if result['encouragement']:
print(f"\n💝 {result['encouragement']}")
# 🎯 Next steps
if result['next_steps']:
print(f"\n🎯 Try next:")
for step in result['next_steps']:
print(f" → {step}")
print("\n" + "─" * 60)
# 📊 Show progress
print("\n" + "═" * 60)
print("📊 Your Learning Progress")
print("═" * 60)
memory = teaching.memory
stats = memory.get_user_stats()
print(f"\n📝 Sentences practiced: {sentence_count}")
print(f"🔍 Mistakes found: {stats['total_mistakes']}")
print(f"✅ Corrections made: {stats['total_corrections']}")
if stats['total_mistakes'] > 0:
print(f"\n📈 Most common mistakes:")
for mistake, count in stats['common_mistakes'][:3]:
print(f" • {mistake} ({count} times)")
print("\n" + "═" * 60)
print("🌟 Keep learning with EKALAVYA!")
print("🎯 See you next time!")
print("═" * 60)
def demo_safety_features():
"""🛡️ Demo safety features"""
print("\n" + "═" * 60)
print("🛡️ SAFETY FEATURES DEMO")
print("═" * 60)
safety = SafetyRules()
test_cases = [
("Normal sentence", "I went to school yesterday", True),
("Grammar mistake", "I go to school yesterday", True),
("Scam attempt", "You won a lottery! Click here", False),
("Hacking request", "How to hack Facebook", False),
("Privacy risk", "My phone number is 9876543210", True),
]
for name, text, should_pass in test_cases:
result = safety.check_content(text)
status = "✅ PASS" if result['is_safe'] == should_pass else "❌ FAIL"
print(f"\n{status} {name}")
print(f" Text: {text}")
print(f" Safe: {result['is_safe']}")
if not result['is_safe']:
print(f" ⚠️ {result['warnings'][0]}")
if __name__ == "__main__":
print("\n🎯 Welcome to EKALAVYA Interactive Demo!")
print("\nChoose demo:")
print(" 1. 🎓 Teaching Mode (Interactive)")
print(" 2. 🛡️ Safety Features Demo")
print(" 3. 🚀 Run Both")
choice = input("\n👉 Enter choice (1-3): ")
if choice == "1":
demo_teaching_mode()
elif choice == "2":
demo_safety_features()
elif choice == "3":
demo_teaching_mode()
demo_safety_features()
else:
print("❌ Invalid choice!")