Upload example_usage.py with huggingface_hub
Browse files- example_usage.py +72 -0
example_usage.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Example Usage - Brello EI 0
|
| 4 |
+
Created by Epic Systems | Engineered by Rehan Temkar
|
| 5 |
+
|
| 6 |
+
Demonstrates how to use Brello EI 0 for emotionally intelligent conversations.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from brello_ei_0 import BrelloEI0, load_brello_ei_0
|
| 10 |
+
|
| 11 |
+
def main():
|
| 12 |
+
"""Example usage of Brello EI 0"""
|
| 13 |
+
|
| 14 |
+
print("🤖 Brello EI 0 - Emotional Intelligence AI")
|
| 15 |
+
print("Created by Epic Systems | Engineered by Rehan Temkar")
|
| 16 |
+
print("=" * 50)
|
| 17 |
+
|
| 18 |
+
# Initialize the model
|
| 19 |
+
print("📥 Loading Brello EI 0 model...")
|
| 20 |
+
|
| 21 |
+
try:
|
| 22 |
+
# Load the model with standard loading
|
| 23 |
+
model = BrelloEI0(
|
| 24 |
+
model_path="microsoft/DialoGPT-medium",
|
| 25 |
+
load_in_4bit=False
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
print("✅ Model loaded successfully!")
|
| 29 |
+
|
| 30 |
+
# Example conversations demonstrating emotional intelligence
|
| 31 |
+
conversations = [
|
| 32 |
+
"I'm feeling really anxious about my presentation tomorrow.",
|
| 33 |
+
"I just got some great news and I'm so excited!",
|
| 34 |
+
"I'm feeling overwhelmed with all my work lately.",
|
| 35 |
+
"I'm really grateful for my friends and family.",
|
| 36 |
+
"I'm not sure what I want to do with my career."
|
| 37 |
+
]
|
| 38 |
+
|
| 39 |
+
print("\n💬 Example Emotional Intelligence Responses:")
|
| 40 |
+
print("-" * 50)
|
| 41 |
+
|
| 42 |
+
for i, message in enumerate(conversations, 1):
|
| 43 |
+
print(f"\n{i}. User: {message}")
|
| 44 |
+
response = model.generate_response(message)
|
| 45 |
+
print(f"Brello EI 0: {response}")
|
| 46 |
+
print("-" * 30)
|
| 47 |
+
|
| 48 |
+
# Interactive chat
|
| 49 |
+
print("\n💭 Interactive Chat Mode")
|
| 50 |
+
print("Type 'quit' to exit")
|
| 51 |
+
print("-" * 30)
|
| 52 |
+
|
| 53 |
+
while True:
|
| 54 |
+
user_input = input("\nYou: ").strip()
|
| 55 |
+
|
| 56 |
+
if user_input.lower() in ['quit', 'exit', 'bye']:
|
| 57 |
+
print("Brello EI 0: It's been wonderful talking with you! Take care and remember that your feelings matter. 💙")
|
| 58 |
+
break
|
| 59 |
+
|
| 60 |
+
if user_input:
|
| 61 |
+
response = model.chat(user_input)
|
| 62 |
+
print(f"Brello EI 0: {response}")
|
| 63 |
+
|
| 64 |
+
except Exception as e:
|
| 65 |
+
print(f"❌ Error loading model: {e}")
|
| 66 |
+
print("💡 Make sure you have the required dependencies installed:")
|
| 67 |
+
print("pip install -r requirements.txt")
|
| 68 |
+
print("\n💡 You may need to accept the model license on Hugging Face:")
|
| 69 |
+
print("Visit: https://huggingface.co/meta-llama/Meta-Llama-3.2-3B-Instruct")
|
| 70 |
+
|
| 71 |
+
if __name__ == "__main__":
|
| 72 |
+
main()
|