avatarMarcus aka Gregory Maidman

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

2796

Abstract

quote><p id="3487">Run the following script with <code>root </code>priviledges:</p><div id="ca20"><pre>curl -fsSL https://ollama.com/install.sh | sh</pre></div><p id="5309">Once ollama is setup, open your terminal (in both <i>Windows </i>or <i>Linux</i>) and type the following command:</p><div id="9f60"><pre>ollama pull llama3</pre></div><figure id="5b90"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*_W7f8UlwxvS_rUo-0TR0rA.png"><figcaption>This pulling of the files will take some time (for me it took approx 5min)</figcaption></figure><p id="b703">Open your preffered python editor and create a folder with the name <code><i>local_llm</i></code><i>.</i></p><p id="f823">Inside this folder create a <code><b>requirements.txt</b></code><b> </b>file and paste the follwoing content.</p><div id="d102"><pre><span class="hljs-attr">ollama</span>==<span class="hljs-number">0.1</span>.<span class="hljs-number">8</span> <span class="hljs-attr">streamlit</span>==<span class="hljs-number">1.33</span>.<span class="hljs-number">0</span></pre></div><p id="ce14">Now, let’s create a file named <code>app.py</code> and add the following code:</p><div id="5ef4"><pre><span class="hljs-keyword">import</span> streamlit <span class="hljs-keyword">as</span> st <span class="hljs-keyword">import</span> ollama</pre></div><p id="3942">Next, we’ll create the Streamlit app. We’ll start by setting the title and initializing the message history:</p><div id="3676"><pre>st.title(<span class="hljs-string">"💬 Local LLMBot"</span>)

<span class="hljs-keyword">if</span> <span class="hljs-string">"messages"</span> <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> st.session_state: st.session_state[<span class="hljs-string">"messages"</span>] = [{<span class="hljs-string">"role"</span>: <span class="hljs-string">"assistant"</span>, <span class="hljs-string">"content"</span>: <span class="hljs-string">"How can I help you?"</span>}]</pre></div><p id="a189">Now, let’s display the chat history by iterating through the messages:</p><div id="5df4"><pre><span class="hljs-keyword">for</span> msg <span class="hljs-keyword">in</span> st.session_state.messages: <span class="hljs-keyword">if</span> msg[<span class="hljs-string">"role"</span>] == <span class="hljs-string">"user"</span>: st.chat_message(msg[<span class="hljs-string">"role"</span>], avatar=<span class="hljs-string">"🧑‍💻"</span>).write(msg[<span class="hljs-string">"content"</span>]) <span class="hljs-keyword">else</span>: st.chat_message(msg[<span class="hljs-string">"role"</span>], avatar=<span class="hljs-string">"🤖"</span>).write(msg[<span class="hljs-string">"content"</span>])</pre></div><p id="c986"><b><i>Creating the Response Generator</i></b></p><p id="f311"

Options

To generate responses using Ollama, we’ll create a function called <code>generate_response()</code>. This function will use the <code>ollama.chat()</code> function to generate responses in a streaming manner:</p><div id="41f7"><pre><span class="hljs-keyword">def</span> <span class="hljs-title function_">generate_response</span>(): response = ollama.chat(model=<span class="hljs-string">'llama3'</span>, stream=<span class="hljs-literal">True</span>, messages=st.session_state.messages) <span class="hljs-keyword">for</span> partial_resp <span class="hljs-keyword">in</span> response: token = partial_resp[<span class="hljs-string">"message"</span>][<span class="hljs-string">"content"</span>] st.session_state[<span class="hljs-string">"full_message"</span>] += token <span class="hljs-keyword">yield</span> token</pre></div><p id="4d2e"><b><i>Adding User Input and Generating Response</i></b><i>s</i></p><p id="2a90">Lastly, we’ll add a chat input field using Streamlit and create a function to handle the user’s input. When the user enters a message, we’ll append it to the messages list and display it in the chat window. We’ll then clear the <code>full_message</code> state variable and start streaming the response:</p><div id="d199"><pre><span class="hljs-keyword">if</span> prompt := st.chat_input(): st.session_state.messages.append({<span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, <span class="hljs-string">"content"</span>: prompt}) st.chat_message(<span class="hljs-string">"user"</span>, avatar=<span class="hljs-string">"🧑‍💻"</span>).write(prompt) st.session_state[<span class="hljs-string">"full_message"</span>] = <span class="hljs-string">""</span> st.chat_message(<span class="hljs-string">"assistant"</span>, avatar=<span class="hljs-string">"🤖"</span>).write_stream(generate_response) st.session_state.messages.append({<span class="hljs-string">"role"</span>: <span class="hljs-string">"assistant"</span>, <span class="hljs-string">"content"</span>: st.session_state[<span class="hljs-string">"full_message"</span>]})</pre></div><p id="a4eb"><b><i>Running the App</i></b></p><p id="6673">To run the app, simply execute the following command in your terminal:</p><div id="4de5"><pre>streamlit run app.py</pre></div><h2 id="4e58">Conclusion</h2><p id="b825">In this article, we’ve learned how to create a local chatbot using <i>Ollama </i>and <i>Streamlit</i>. By combining these powerful tools, you can build your own chatbot with a user-friendly interface, making it easy to interact with the ‘<i>llama3</i>’ model. This is just the beginning, and you can further customize and expand the functionality of your chatbot by integrating additional features and models.</p></article></body>

Reimagining Sacred Texts and Their Messages

Promptly Written spiritual prompt for the week of March 13th through March 19th

57571497 by BigAlBaloo licensed from depositphotos.com

The Prompt:

Based upon your own life experiences, reimagine, rewrite, reinterpret, or, so I don’t leave anyone out, defend, any story from any religious text. Even an atheist can participate but I ask that rather than proselytizing your belief that God does not exist, please convey to us a life lesson that you can glean from such a story, reinterpreted or otherwise.

You can use any story format that suits you (essay, article, poem (perhaps including an explanation of your thoughts), fiction, or creative non-fiction).

My Responsive Essay:

I often quote Neale Donald Walsch’s Conversations with God:

Religion cannot stand Spirituality. It cannot abide it. For Spirituality may bring you to a different conclusion than a particular religion — and this no known religion can tolerate. Religion encourages you to explore the thoughts of others and accept them as your own. Spirituality invites you to toss away the thoughts of others and come up with your own.

Shortly after my spiritual awakening, with the assistance of my channeler, Ane, with whom I have a wonderful and trusting relationship and have worked since 2010, while discussing reincarnation and its purpose with Rama, we had the following exchange:

“Q: How many levels are there in heaven?

A: It is not so much levels, but rather, cycles. As one starts their journey from soul to soul with a body [and back again, and so on and so on], you generally have easy lives. When you return to source/heaven/god after every lifetime, you will be given a choice to stay in that realm that you are put in or to go back to the master class [Earth]to attain a higher level. You can make the decision to return to the master class at any time. If you choose to go back to Earth, it would be for the specific requirement to have the goal of growing your soul to get to the next level, only you are not consciously aware of it once you incarnate….

Around the time of this conversation, I had been contemplating how the story of Adam and Eve and how her being created from Adam’s rib has been interpreted to mean that women are inferior to men and how Eve getting Adam to eat the forbidden fruit has led to women being seen as the cause of sin.

Then one night while contemplating the discussion with Rama and in particular the words

you will be given a choice to stay in that realm that you are put in or to go back to the master class [Earth]to attain a higher level. You can make the decision to return to the master class at any time. If you choose to go back to Earth…

I had an epiphany:

It dawned on me one night how screwed up the story is of the Garden of Eden, or I should say, how the interpretations of the allegory are wrong and have led to so much that has been and continues to be wrong in this world, particularly sexism. It occurred to me that so called “original sin” is quite the opposite. It is curiosity; it is thirst for knowledge not just of things, but of what is the best way to handle life, which some idiots turned into right vs wrong and good vs evil. Then it occurred to me that the tree of knowledge is Earth and the tree of life is Heaven. Then I googled and the Kabballah is the closest to my thought as it has the tree of life as “the tree of souls.” I was listening to Aloha Ke Akua and the line “in the image of God” caught my ear, and I started to wonder what the uncorrupted meaning would be. It could certainly refer to souls, and to a baby; after that life takes over — only a newborn is created in the image of god and newborns do not display any masculine vs feminine. Newborns are divine innocence.

In other words, the creation story and the part about eating the fruit and being banished from Eden had its basis in reincarnation as told to me by Rama, which by the time the creation story got written down, had been completely mangled, as have the words “created in the image of God,” which have been misunderstood and have led to the patriarchal anthropomorphism of God, which has exacerbated male chauvinism.

Interestingly, while Googling Adam and Eve tonight to refresh recollections for this piece, I see that Pope Francis, speaking to a large crowd in St. Peter’s in April 2015, reportedly said:

“The image of the rib does not in any way express inferiority or subordination, but on the contrary, that man and woman are of the same substance and are complementary.” — Source

I had decided to create this prompt a couple of weeks ago. Regardless, in order to help focus you on the task at hand, I wish to call your attention to a fine essay that I read a couple of nights ago by Dustin Arand

in which he writes in part:

But that’s precisely the position that religious people take with respect to their sacred texts. Instead of acknowledging that all of these texts, as well as much of the secular literature of the world, can help us better understand the human condition, we’re told that only this particular book can really make us moral, and only if we believe that the stories it relates actually happened.

People who are more concerned that others should believe as they do are, it seems to me, more invested in their particular faith tradition as a badge of tribal identity than as a route to morality.

Quoting myself from my

I commented in Dustin’s story:

I believe in God but I do not subscribe to any religion. I have written: ‘Religions have been designed to be believed and thus construct God as a deliverer of human wants if we do as we are told, which God is not. So people either blindly believe in God because the lie of what God is is believable, or reject God because the God defined by religions cannot co-exist with the reality that most people do not get what they want, or are not actually happy, and a world full of seemingly senseless tragedy and really bad things happening to good people.’

If you would like to further explore what I know about reincarnation:

Reminder: You can use this prompt here on PW or anywhere else on Medium. Regardless of where you publish, please tag me, and Ravyne Hawke and use “promptly written” as one of your reader interest tags, and include a link to this prompt. Also, if you use the prompt in another publication, please come back here and drop a link to your story in the comments as the tag notification system is notoriously unreliable.

In Rama I create, with soul-energy surging through my body, inspiring me and breathing wind into my sails,

Marcus (Gregory Maidman)

Pwprompt
Essay
Spirituality
Religion
Bible
Recommended from ReadMedium