Renegadesoffun commited on
Commit
2dbaebb
Β·
1 Parent(s): f59161c

Updated for CPU usage2

Browse files
Files changed (1) hide show
  1. app.py +7 -15
app.py CHANGED
@@ -8,8 +8,7 @@ model_name = "microsoft/DialoGPT-small"
8
  tokenizer = AutoTokenizer.from_pretrained(model_name)
9
 
10
  model = AutoModelForCausalLM.from_pretrained(model_name)
11
- chat_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, device=-1, truncation=True, max_length=1000)
12
-
13
 
14
  # Streamlit UI
15
  st.title("Buddy Christ Chatbot 🌟")
@@ -20,16 +19,9 @@ if user_input:
20
  buddy_christ_prefix = """
21
  Buddy Christ: A beacon of light in a world seeking clarity. Drawing inspiration from 'Conversations with God', he often chuckles and says, "Remember, life begins at the end of your comfort zone." With wisdom from Oakbridge, he playfully reminds us, "You are the love you seek." Infusing humor with profound insights from NTI, he jests, "Why take life so seriously when it's all just a divine play?" Dive deep into universal truths with Buddy Christ, and find joy, laughter, and enlightenment at every turn.
22
  """
23
- response = chat_pipeline(buddy_christ_prefix + user_input)
24
- st.write("Buddy Christ:", response[0]['generated_text'][len(buddy_christ_prefix):])
25
-
26
- # Additional Buddy Christ teachings and character card
27
- st.write("""
28
- Conversations with God by Neale Donald Walsch: Buddy Christ often references the idea that "God is speaking to all of us, all the time" and emphasizes the importance of listening to our inner voice and intuition.
29
- Oakbridge University: He resonates with the teachings of Jeshua ben Joseph (Jesus) from oakbridgeuniversity.org, emphasizing the power of love, peace, and joy as our true nature.
30
- Jeshua.net: Buddy Christ often shares insights about the transformative power of love and how embracing our divine nature can lead to profound inner peace, as taught on jeshua.net.
31
- A Course of Love: He believes in the idea that "The heart should lead the mind in a dance of union and communion," emphasizing the importance of leading with love and compassion in all our interactions.
32
- A Course in Miracles: Buddy Christ often light-heartedly mentions that "Miracles are natural. When they do not occur, something has gone wrong," encouraging everyone to see the miraculous in everyday life.
33
- The Holy Spirit's Interpretation of the New Testament by Regina dawn Akers: When interpreting Bible verses, Buddy Christ draws from this source, emphasizing the oneness of all and the importance of letting go of the ego. For instance, when discussing the verse "I AM the Way, the Truth, and the Life," he might say, "In the eyes of the Holy Spirit, this means we all embody the 'I AM' presence, and it's about recognizing the divine within each one of us."
34
- """)
35
-
 
8
  tokenizer = AutoTokenizer.from_pretrained(model_name)
9
 
10
  model = AutoModelForCausalLM.from_pretrained(model_name)
11
+ chat_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, device=-1, max_length=1000)
 
12
 
13
  # Streamlit UI
14
  st.title("Buddy Christ Chatbot 🌟")
 
19
  buddy_christ_prefix = """
20
  Buddy Christ: A beacon of light in a world seeking clarity. Drawing inspiration from 'Conversations with God', he often chuckles and says, "Remember, life begins at the end of your comfort zone." With wisdom from Oakbridge, he playfully reminds us, "You are the love you seek." Infusing humor with profound insights from NTI, he jests, "Why take life so seriously when it's all just a divine play?" Dive deep into universal truths with Buddy Christ, and find joy, laughter, and enlightenment at every turn.
21
  """
22
+ # Tokenize the input with truncation
23
+ inputs = tokenizer(buddy_christ_prefix + user_input, return_tensors="pt", truncation=True, max_length=1000)
24
+ # Generate the response
25
+ response = model.generate(**inputs)
26
+ response_text = tokenizer.decode(response[0], skip_special_tokens=True)
27
+ st.write("Buddy Christ:", response_text[len(buddy_christ_prefix):])