<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jesse JCharis on Medium]]></title>
        <description><![CDATA[Stories by Jesse JCharis on Medium]]></description>
        <link>https://medium.com/@jcharistech?source=rss-6e2e555bfcc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ioXFl0WF-oaDLeZA.jpg</url>
            <title>Stories by Jesse JCharis on Medium</title>
            <link>https://medium.com/@jcharistech?source=rss-6e2e555bfcc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 18:36:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jcharistech/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Forces Beyond The Visible Part of ElectroMagnetic Spectrum — What if?]]></title>
            <link>https://medium.com/@jcharistech/forces-beyond-the-visible-part-of-electromagnetic-spectrum-what-if-6a0dbf1ebdd2?source=rss-6e2e555bfcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a0dbf1ebdd2</guid>
            <category><![CDATA[thoughts-and-ideas]]></category>
            <category><![CDATA[electromagnetism]]></category>
            <category><![CDATA[theology]]></category>
            <category><![CDATA[athiesm]]></category>
            <dc:creator><![CDATA[Jesse JCharis]]></dc:creator>
            <pubDate>Fri, 20 Dec 2024 20:54:29 GMT</pubDate>
            <atom:updated>2024-12-20T20:59:04.672Z</atom:updated>
            <content:encoded><![CDATA[<h3>Forces Beyond The Visible Part of ElectroMagnetic Spectrum — What if?</h3><p>Light is a form of energy that stimulate our sense of vision. It is one of the most important forms of energy. Visible light s the visible part of the electromagnetic radiation that can be perceived by the eyes — be it the eyes of animals or otherwise. Light is both a particle and a wave. Our primary source of light on earth is the Sun, the moon and the stars are additional sources of light. Fire is also a form of light as it gives both light and heat. In our modern times we have been able to create other sources of light via electricity. Light is very important to life. Despite light being part of the electromagnetic radiation, it is the only one that is naturally visible to the human eye. Our retinal cones and rods are designed to only be stimulated by a specific wavelength of the electromagnetic radiation. This is what gives us vision. Beyond this wavelength there exist other part of the electromagnetic radiation that we cannot see. The electromagnetic spectrum and radiation is seen as both a particle and a wave.The electromagnetic waves in each of these bands have different characteristics, such as how they are produced, how they interact with matter, and their practical applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/0*zDavZH_VleQs1-cj.png" /></figure><p>There are Gamma Rays, X-Rays, UV rays and infrared rays, microwaves, FM,AM and Radio Waves. We can only see in a small fraction of this electromagnetic radiation. Our eyes are designed to see just a small part — the visible spectrum. Hence for people to say that there is no visible evidence for a supreme being or other entities is very limiting. We know from empirical study and physics that there exists other EMR (Electromagnetic Radiation) which we can harness. We use microwaves to warm our foods- but we cannot see it. Does this means it does not exist? We send messages and tons of information via radio waves and WIFI, we cannot see radio waves with our naked and unaided eyes, does that mean it does not exist?</p><p><em>I am the LORD, and there is none else, there is no God beside me: I girded thee, though thou hast not known me:</em></p><p><em>That they may know from the rising of the sun, and from the west, that there is none beside me. I am the LORD, and there is none else.</em></p><p><strong><em>I form the light, and create darkness: I make peace, and create evil: I the LORD do all these things.</em></strong></p><p>What if God or the forces that manges the universe exists beyond the visible part of the electromagnetic spectrum? What if there exist beings who our eyes have not been designed to see. We may never be able to see them now because we do not have the technology to enable us to visualize this entities. Although we cannot see infrared rays, we can use other forms of technology such as thermal imaging to visualize infrared rays. Snakes and other species can see in this Infrared rays spectrum. Why is this possible? — Because they have been designed or evolved to be able to see within such a spectrum. Bats uses echolocation to visualize their way at night.</p><p>In the book of Isaiah, it is mentioned that God said he formed the light and the darkness. This means that God formed at least the visible spectrum of the electromagnetic radiation. It also says he created the darkness. Darkness is defined as the absence of light or minimal illumination. The darkness is all the other part of the electromagnetic radiation that we cannot see naturally. It is all the other spectrum, from gamma rays to radio waves. Darkness is simply the absence of visible light. That means all the other part of EMR that is not we cannot visibly see. If God formed the light and created the darkness, then that means he created the EMR.</p><p>What if for each part of the electromagnetic radiation, there are entities that God created that can only see per each spectrum? Just as humans and animals can see in the visible spectrum (specific wavelength and frequency) , the other entities can see in infrared, or UV or radio waves. And just as light is very important for humans and has several use case, so the other part of the EMR of which we are now able to harness. Because of the broadness of the EMR, the other entities which have been designed to see in a particular part of the electromagnetic radiation, may not even need the light of the sun. They can dwell in darkness or better said in the absence of the light, and function perfectly. There exist several species that do not have our form of eyes and they function properly. There are aquatic organisms in the deepest and darkest part of the sea that survive pretty well without light. <strong><em>Could there be celestial or terrestrial or subterranean beings that are designed to see in darkness and therefore we can never see and they do not need our Sun to thrive?</em></strong></p><p>There is so much we do not know about our universe. We are just scratching the surface. This is one of the reason, I believe we cannot say for sure if God exist or doesn’t exist. Our concepts of God across the various centuries and religions may be faulty but that does not mean there is no supreme entity or entities or forces that manages and designs all these vastness of the universe.</p><p><strong><em>There is more to see and to know</em></strong></p><p><strong>Jesus Saves</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a0dbf1ebdd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Age of the Earth — Young Earth vs Old Earth]]></title>
            <link>https://medium.com/@jcharistech/age-of-the-earth-young-earth-vs-old-earth-ff205a5c4363?source=rss-6e2e555bfcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff205a5c4363</guid>
            <category><![CDATA[young-earth-creationism]]></category>
            <category><![CDATA[religion]]></category>
            <category><![CDATA[age-of-the-earth]]></category>
            <category><![CDATA[evolution]]></category>
            <dc:creator><![CDATA[Jesse JCharis]]></dc:creator>
            <pubDate>Thu, 19 Sep 2024 08:51:39 GMT</pubDate>
            <atom:updated>2024-09-19T08:51:39.923Z</atom:updated>
            <content:encoded><![CDATA[<h3>Age of the Earth — Young Earth vs Old Earth</h3><p>Evolutionist and most scientist proclaim and believe that the earth and the universe are millions of years old, however most religious folks such as Christians, Jews and Muslims believe otherwise. They say that the earth is quite young perhaps a few thousands of years like 7000 based on what they think the bible means and biblical archaeology.</p><p>However there is another way we can look at this. In Genesis we are told that God made Adam and Eve, but it appears that both humans were made as adults not as kids or babies. They could walk, talk and even name the animals in the garden. They knew how to sow cloths to wear, etc. This means that although they were made on the 6th day of Creation , they were already old.</p><p>Could it be the same with the age of the earth, that although from biblical archaeology and history the world is like 7000 years but with carbon dating and fossil record of the age of the earth it is millions of years old. Just as Adam and Eve were created as adults directly already with age, could it be the same with the earth?</p><p>God made the earth young but already aged as millions of years. In other words the earth is like how Adam and Eve were made, young (few days) but old like adults and fully grown.</p><p>To conclude, I believe that both Young Earth and Old Earth are looking at it differently, the earth was made young but as a fully grown “Adult” — millions of years.</p><h4>Jesus Saves</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff205a5c4363" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Benefits , Threats and Downsides of LLMs and ChatGPT]]></title>
            <link>https://medium.com/@jcharistech/the-threats-and-downsides-of-llms-and-chatgpt-e254f0277b56?source=rss-6e2e555bfcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/e254f0277b56</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[jcharistech]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Jesse JCharis]]></dc:creator>
            <pubDate>Mon, 24 Apr 2023 00:40:17 GMT</pubDate>
            <atom:updated>2023-04-24T00:53:55.369Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*O6X1MgIS3zXCMjcJ.jpg" /></figure><p>ChatGPT and LLMs(Large Language Models) are very useful information and search technologies.<br>Unlike search engines,they do not just give information when queried they rather generate the written content.<br>They offer several benefits such as below.</p><ul><li>It offers a conversational and interactive experience for retrieving information.</li><li>It can be used for language translation and grammer correction</li><li>It can summarize long text and even outline as bullet points documents efficiently</li><li>It can generate text and personlized response.</li><li>It can serve as a coding assistant to fix bugs, write code and even be your personal Stackoverflow</li><li>ChatGPT saves time by giving detailed responses and answering multiple questions in only one conversation.</li><li>It can serve as task agents to execute task autonomously with the release of AI agents and Plugins</li><li>Create new roles and job opportunities like LLM engineers, Prompt Engineers, Chatbot developers, PEO(Prompt engine optimisation) similar to SEO</li><li>etc</li></ul><p>However with every technology, there are disadvantages and certain dangers it can pose.</p><h4>Monopoly on Answers</h4><p>The current forms of LLM being used monopolize answers to question by giving only one answer at a time unlike traditionally search engines that offers multiple results of which you decide which to pick. Although there is PageRank, with chatgpt, there is only a first answer then you can ask it for more.</p><p>Traditional search engines offers multiple results at a time but with LLM and ChatGPT you require a follow up prompt to get more results. This is good but also it has it disadvantages. It can lead you towards a path were it decides for you.</p><p><strong>Suggested Fix and Mitigation</strong>:<em> the suggested fix to this monopoly on the answers ChatGPT gives is for future iterations to offer multiple valuable answers with a form of ranking or a singular aggregated answer with multiple references.</em></p><h4>Diversity of Results</h4><p>As of now ChatGPT and LLM return only textual answers to queries, however with traditional search engines, we have not only text, but images and videos. This is useful as a picture can sometimes tell you more than just text.</p><h4>Misinformation and Hallucination</h4><p>Content generated by ChatGPT can sound very confident and authoritative yet it may be slightly wrong. This may appear as the correct answer to a novice to the subject however it will not be the right answer. This tendency can add to the torrent of misinformation already available online.</p><p>ChatGPT provides finely tuned target answer which can both be an advantage and a disadvantage. If ChatGPT or other LLMS offer misleading answers ,it will be very difficult to spot if not crossed checked. LLMs are models that predict the likelihood and probability of utterances and what text is next in line. That is what we should not forget, they are sophisticated predictors hence they can misinform. Large Language Models are advance pattern recognizers and as such can identify patterns of how humans communicate with language. Because of this it can appear trustworthy however it may be hallucinating the response as though they were legitimate answers. We should be prepared for the hazards that will emerge from misinformation and disinformation from LLMs.</p><p><strong>Suggested Fix and Mitigation</strong>: <em>the possible way to improve is to have a fact checking feature or a form of reference to where and why that answer was chosen as the response. We should see LLMs as assistance not as authoritative sources except with legitimate references. Even with references generated by LLMs we should also verify and check if they are actually correct and not another layer of misinformation on top of the previous response.</em></p><h4>Information Leaks</h4><p>Since LLMs are trained on large sums of data, it is possible to retrieve from the model certain forms of data, i.e private data or sensitive information. This can happen and will happen as individual users and organizations fine tune the base LLMs (called foundation models) based on their private or organizational data sources. As more LLMs are designed and connected to several applications,it is possible to prompt the LLM to generate sensitive information upon which it was trained. The LLM being able to “remember” what it was trained on may leak sensitive data or even repeat a previously seen answer instead of really generating new response.</p><p>Most of the current family of large language models are trained on batch data but in the coming years if they are trained with incremental or online streaming data, the issue will become out of hand. For example imagine using LLMs in your coding IDE or your Office Suite, unintentionally if it is learning incrementally, it is possible to expose and export secrets and API Keys.</p><p><strong>Suggested Fix and Mitigation</strong>: <em>the possible way to mitigate this is to ensure that private data and sensitive information are anonymised or redacted before training. There should also be a mechanism to hash secrets and API keys using LLMs in your coding IDE or Office Suites.</em></p><h4>Stale Data</h4><p>If ChatGPT is trained on previous data i.e batch ML then it will fall short of the most recent news and events unless<br>it is constantly being retrained on emerging and current data. Since it <strong>cannot yet </strong>access real-time facts and events, it will appear to generate misleading answers if queried about recent topics beyond the limit of its training data.</p><h4>Human Generated Data/Content Vs AI Generated Data Loop</h4><p>As LLMs and ChatGPT depends on human generated content and data, that means that it will require more data and more compute to improve and give recent results. <strong>So who is going to be feeding it human generated data or content ?</strong></p><p>Unlike traditional search engines where web-crawlers craws the internet for other people’s content, ChatGPT will need a similar method to get human generated data to feed it system. There is the problem of <strong><em>AI Generated Data loop</em></strong> . This is where the new data that is fed into ChatGPT or other LLMs was previously generated by ChatGPT itself or other AI systems. In this case we will need a system to filter out Human generated content from AI/ChatGPT generated content.</p><p>If this is not fixed, the Models will become stale and lose it performance , authenticity and human touch. As of now it is possible to determine machine generated text from human generated text via methods like</p><ul><li>Diversity Score</li><li>Perplexity Score</li><li>Rouge and Bleu methods used for evaluating summaries</li><li>etc</li></ul><p>However as LLMs and AI becomes more sophisticated and more intelligent, the ability to distinguish machine generated text and human generated text content will be very difficult.</p><p><strong>Suggested Fix and Mitigation</strong>: <em>We will need different and advanced methods beyond the statistical evaluation methods to detect and filter out AI Generated Content, Machine Generated Data and Human Generated content. For the Data Feeding Loop it is unavoidable.</em></p><h4>Plagiarism</h4><p>Although ChatGPT is awesome, it is not yet capable of original thought. As creative as the responses of ChatGPT and LLM are it is based on training data patterns.Therefore it is prone to pick other peoples content without knowing where it was initially taken.<br>This can be fixed by identifying the source from which the data is coming from and giving references. In traditional search engines, we mostly know the source of the data via the hyperlink or URL.</p><p><strong>Suggested Fix and Mitigation</strong>: <em>the possible way to improve is to have a form of reference</em></p><h4>Limited Context and Specific Prompt Engineering</h4><p>LLM and ChatGPT are as accurate and detailed as how good your query or prompt engineering is. Hence you will need to excel in prompt engineering to get the most and the best of it.<br>Although it uses zero-shot learning /few-shot learning, without proper context, it will not give you what you really want. This is almost the same as search queries in traditional search engines. You will need prompt augmentation (i.e providing context information about the prompt or question you have given), such as<br>Given the following information, create ...</p><h4>The internet does not forget, so does LLM and ChatGPT</h4><p>There is a common saying that what you put online stays there forever even if you delete it, it is on someone else device. The same can be said of ChatGPT and LLM unless it is retrained from scratch. This means that all the data used<br>in training are still available in the model somehow.<br>When you build a model, the neural network adapts to the input data by assigning different “weights” to each data point in subsequent layers. Therefore, the LLM or ChatGPT will remember what it has learned even if the original information is deleted from the base layer. This will make it difficult to remove your personal data from an LLM unless it is anonymized before training.</p><p><strong>Suggested Fix and Mitigation</strong>: <em>The first mitigation is for individuals not to put sensitive information into the collectors for training LLMs or post it online. Moreover during and before training the data should be anonymized if possible.</em></p><h4>TextFake</h4><p>With Chatgpt, it is possible to create credible phishing content for social engineering. It can also be used to create almost true results that can be misleading to the novice. Just like DeepFake, textfake is a concern we should be considering with the advent of LLMs.</p><p>Textfake refer to machine or AI generated text that is designed to mimic human writing style however it has a subtle level of misinformation and lies covered in mostly true and correct information. Textfakes can also fool individuals and systems as being authoritative correct answers. LLMs can generate textfakes by offering widely accepted and opinionated answers as facts and presenting them as valid and “true” although they are not.</p><p>We should have a system to facts check the generated answer by an LLM such as ChatGPT or Bard,etc.</p><h4>Information and Misinformation Harms and Hazards</h4><p>LLMs are trained on human language and as we all know humans lie and err, therefore it is possible for LLMs to pick this pattern during training. Due to this reason, there can be misinformation and disinformation. This can result in several harms and hazards as people accept the authoritative and confident responses of LLMs such as GPT-x and believe in them as truth without verifying.</p><p>Imagine incorporating LLMs into Health bots that act as a therapists or counselor. If not properly done, this can cause harm to the troubled individual.</p><h4>Latent Capabilities of Large Language Models</h4><p>Language is how we communicate as humans. It is with language that we do almost every activity. As such with the advent and advancement of large language models, it is possible to identify certain hidden capabilities in an LLM which we are not yet aware or prepared for. These latent capabilities of language models will definitely come with opportunities and risks. The first to discover these capabilities and utilize them will have an advantage over others.</p><h4>Job Displacement</h4><p>With the advent of any new technology there is the need to adapt and adopt your strategy for performing work. LLM and AI are here to stay and to assist humanity therefore they will definitely replace some job roles and introduce new job roles. As AI becomes more useful and advance, certain jobs will be automated and displaced. Others will be enhanced and others will stay the same. This is both an opportunity and a downside which we should consider.</p><h4>Monetization and Advertisement</h4><p>Large Language Models require huge sums of data and compute to build and train, so cooperations that will be offering LLMs will need their money back somehow. In most search engines, advertisement is one of the way they monetize their services. And these adverts can be content specific and location specific. In the case of LLMs and ChatGPT, we should be concern about how ads will be used in the platform and how it is going to be.</p><p>In this post, we have seen some threats and downsides that large language models and ChatGPT may pose , however there are several benefits of this technology that we should not overlook or undermine.</p><p><em>Thanks for your attention</em></p><p><strong><em>Jesus Saves</em></strong></p><p><strong>By Jesse E.Agbe(JCharis)</strong></p><p><em>Originally published at </em><a href="https://blog.jcharistech.com/2023/04/24/the-threats-and-downsides-of-llms-and-chatgpt/"><em>https://blog.jcharistech.com</em></a><em> on April 24, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e254f0277b56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Run Streamlit Apps From Colab]]></title>
            <link>https://medium.com/@jcharistech/how-to-run-streamlit-apps-from-colab-29b969a1bdfc?source=rss-6e2e555bfcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/29b969a1bdfc</guid>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ngrok]]></category>
            <category><![CDATA[colab]]></category>
            <dc:creator><![CDATA[Jesse JCharis]]></dc:creator>
            <pubDate>Tue, 18 Aug 2020 08:10:16 GMT</pubDate>
            <atom:updated>2020-08-18T08:10:16.389Z</atom:updated>
            <content:encoded><![CDATA[<p>The simplicity that streamlit offers for building apps is so cool and useful. But sometimes you may be constrained by lack of compute or incompatible working environment on your local computer.</p><p>In most cases Colab solves that problem. But what if you want to share your streamlit app with others from Colab.</p><p>In this tutorial we will be learning how to run or deploy our streamlit app from Google’s Colaboratory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*16hW2VHwnVOTEgdB.png" /></figure><p>Let us start. This is a simple overview of what we will be doing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*WT0NfMAnJmfgNaqV.png" /></figure><p><strong>Create An Account on Ngrok</strong></p><p>Ngrok is a powerful solution for providing secure tunnels from your local system to the public. So the first task is to signup to ngrok.com and create a free account.This will give you access to several features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*37a-anm_Ew92wmQ_.png" /></figure><p><strong>Get Your Authentication Tokens</strong></p><p>To use ngrok,you will need to an authentication token which can be found on your dashboard of your ngrok account ( <a href="https://dashboard.ngrok.com/get-started/setup"><em>https://dashboard.ngrok.com/get-started/setup</em></a> ).</p><p>This is what you will use to authenticate when working with ngrok. You can find your authtokens below the ‘Connect Your Account’ like this</p><p><strong><em>./ngrok authtokens xxxxxxxxxxxxxxxxxxxx</em></strong></p><p>This is what you will use to connect your account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*LhXFAqrr46sS3NFo.png" /></figure><p><strong>Working Inside Colab</strong></p><p>In your colab instance you can install the necessary packages you need for your app. But the two most important for running streamlit is ofcourse streamlit and then pyngrok.</p><p>Since you are working inside Colab a.k.a. Jupyter Notebooks in the Cloud with Fast Compute, you will need to use the ! sign in front of any linux/unix command for installing and running unix based command. Hence in our case we can install streamlit and pyngrok as below</p><pre>!pip install streamlit</pre><pre>!pip install pyngrok</pre><p><strong>Write Your App to Your Colab Sandbox</strong></p><p>There are several ways to run your script from colab but the simplest is to write your code to a file and save it to your current instance using the<strong><em> %%writefile</em></strong> . The <strong><em>%%writefile</em></strong> will write the current cell below to the filename specified.</p><p>In our case</p><pre>%%writefile app.py<br>import streamlit as st<br>PAGE_CONFIG = {&quot;page_title&quot;:&quot;StColab.io&quot;,&quot;page_icon&quot;:&quot;:smiley:&quot;,&quot;layout&quot;:&quot;centered&quot;}<br>st.beta_set_page_config(**PAGE_CONFIG)<br></pre><pre>def main():<br>	st.title(&quot;Awesome Streamlit for ML&quot;)<br>	st.subheader(&quot;How to run streamlit from colab&quot;)<br></pre><pre>	menu = [&quot;Home&quot;,&quot;About&quot;]<br>	choice = st.sidebar.selectbox(&#39;Menu&#39;,menu)<br>	if choice == &#39;Home&#39;:<br>		st.subheader(&quot;Streamlit From Colab&quot;)	</pre><pre>if __name__ == &#39;__main__&#39;:<br>	main()</pre><p>To check if the file was written to your current colab sandbox, you can use the list command eg</p><pre>!ls</pre><p><strong>Start Your App</strong></p><p>Now that we have written our app, we can now start our app like we would have done if we were running it locally. But the caveat is to run it in the background so that if the cell finish running, our app will continue to run as a background process behind.</p><p>We can do so using nohub or disown.</p><pre>!nohub streamlit run app.py &amp;</pre><p>In some cases if nohub fails to work you can use the basic linux command for running processes in the background.</p><pre>!streamlit run app.py &amp;&gt;/dev/null&amp;</pre><p>This will start streamlit on the normal default port of 8501 which we will use for the next section in pyngrok.</p><p><strong>Create A Secure Tunnel Using Pyngrok</strong></p><p>As we learnt earlier ngrok allows us to create a secure tunnel for accessing our local apps and webhooks. We will be using pyngrok which acts as a python wrapper around ngrok. Installing pyngrok both offers the python package as well as the CLI hence you can use any as you wish.</p><p>To create our tunnel we will be using pyngrok and passing in the port from streamlit (ie 8501) .</p><pre>from pyngrok import ngrok</pre><pre># Setup a tunnel to the streamlit port 8501<br>public_url = ngrok.connect(port=&#39;8501&#39;)<br>public_url</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*lLLH3IM8rC4VHb-U.png" /></figure><p>This will generate a public URL (something like <a href="http://25ba3010d477.ngrok.io/"><em>https://b546sh556d.ngrok.io</em> </a>) that your app will be running on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*THm8jFo7UsaJIke_.png" /></figure><p>Viola our app works. We have successfully deployed our streamlit app from Google’s Colab using Ngrok.</p><p><strong>Shutting Down Your App</strong></p><p>In case you want to shut down your app, you will have to first check the process streamlit is running on and then kill that process.</p><pre>!pgrep streamlit</pre><p>or</p><pre>!ps -eaf | grep streamlit</pre><p>Then kill the process</p><pre>kill 445</pre><p>After that you can shutdown ngrok from python</p><pre>ngrok.kill()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*0EvzOwyruH2tvzjw.png" /></figure><p>You can also check out the video tutorial <a href="https://www.youtube.com/watch?v=x0NdZkaciws">here</a></p><p><em>Thank you for your time</em></p><p><em>Jesus Saves</em></p><p><em>By Jesse.E.Agbe(JCharis)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29b969a1bdfc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple NLP app with Spacy-Streamlit]]></title>
            <link>https://medium.com/@jcharistech/simple-nlp-app-with-spacy-streamlit-35238abab9f4?source=rss-6e2e555bfcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/35238abab9f4</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[spacy]]></category>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[spacy-streamlit]]></category>
            <dc:creator><![CDATA[Jesse JCharis]]></dc:creator>
            <pubDate>Thu, 09 Jul 2020 12:56:00 GMT</pubDate>
            <atom:updated>2020-07-09T12:56:00.665Z</atom:updated>
            <content:encoded><![CDATA[<p>Simple NLP app with Spacy-Streamlit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*fCcV7JwJ8ni_gICvN2wEMg.png" /></figure><p>In this tutorial we will build a simple natural language processing(NLP) app with an awesome package called<strong><em> Spacy-Streamlit</em></strong>. Spacy-Streamlit is a python package that is useful for visualizing <a href="https://spacy.io/">spaCy</a> models and building interactive spaCy-powered apps with <a href="https://streamlit.io/">Streamlit</a>.</p><p>It has several functions and utils for visualizing spacy’s essential NLP features such as</p><ul><li>Tokenization using <strong><em>visualize_tokens()</em></strong></li><li>NER(Named Entity Recognition) using <strong><em>visualize_ner()</em></strong></li><li>Parser using <strong><em>visualize_parser()</em></strong></li><li>Sentence Similarity using <strong><em>visualize_similarity()</em></strong></li><li>Text Categorizer using <strong><em>visualize_textcat()</em></strong></li><li>etc</li></ul><p>With Spacy-streamlit making visualization for NLP task is very easy and requires little code. It contains several building block for doing some cools stuff.</p><p>Let us see how to install and how to build a simple NLP app with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*eDhyGlDkZHxB8a-0.png" /><figcaption>NLP App— NER Section</figcaption></figure><p><strong>Installation</strong></p><pre>pip install spacy-streamlit</pre><p>NOTE: you will also need to install <strong>streamlit and spacy</strong> alongside their models.</p><p>In installing the various models you can use</p><pre>python -m spacy download en</pre><p>Our simple app will have two main sections:</p><ul><li>Home</li><li>NER</li></ul><p><strong>Home</strong>: This is where we will analyze and display our text as tokens</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*chJKKhbYD5AW4t2W.png" /></figure><p>We will be using the basic streamlit <strong><em>st.text_area()</em></strong> function for receiving input from the user and then we will use <strong><em>spacy_streamlit.visualize_tokens()</em></strong><em> </em>to visualize and analyze our text like below.</p><p>spacy_streamlit.visualize_tokens(docx,attrs=[&#39;text&#39;,&#39;pos_&#39;,&#39;dep_&#39;,&#39;ent_type_&#39;])</p><p>The spacy_streamlit.visualize_tokens() by default will list all the attributes, but you can specify which attributes you would like to analyze and display as a dataframe.</p><p><strong>NER</strong>:In this section of the app we will visualize any named entity in our text using the <strong><em>space_streamlit.visualize_ner( )</em></strong> function</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*5DWCjdhFbSWLynG-.png" /></figure><p>With this function you can even omit entity labels you don’t want to recognize which is quite cool considering the numerous ways we can apply this.</p><p>Below is the entire code for our NLP app.</p><pre># Core Pkgs<br>import streamlit as st </pre><pre># NLP Pkgs<br>import spacy_streamlit<br>import spacy<br>nlp = spacy.load(&#39;en&#39;)</pre><pre>import os<br>from PIL import Image<br></pre><pre>def main():<br>	&quot;&quot;&quot;A Simple NLP app with Spacy-Streamlit&quot;&quot;&quot;</pre><pre>	st.title(&quot;Spacy-Streamlit NLP App&quot;)<br>        our_image = Image.open(os.path.join(&#39;SpaCy_logo.svg.png&#39;))<br>	st.image(our_image)</pre><pre>	menu = [&quot;Home&quot;,&quot;NER&quot;]<br>	choice = st.sidebar.selectbox(&quot;Menu&quot;,menu)</pre><pre>	if choice == &quot;Home&quot;:<br>		st.subheader(&quot;Tokenization&quot;)<br>		raw_text = st.text_area(&quot;Your Text&quot;,&quot;Enter Text Here&quot;)<br>		docx = nlp(raw_text)<br>		if st.button(&quot;Tokenize&quot;):<br>			spacy_streamlit.visualize_tokens(docx,attrs=[&#39;text&#39;,&#39;pos_&#39;,&#39;dep_&#39;,&#39;ent_type_&#39;])</pre><pre>	elif choice == &quot;NER&quot;:<br>		st.subheader(&quot;Named Entity Recognition&quot;)<br>		raw_text = st.text_area(&quot;Your Text&quot;,&quot;Enter Text Here&quot;)<br>		docx = nlp(raw_text)<br>		spacy_streamlit.visualize_ner(docx,labels=nlp.get_pipe(&#39;ner&#39;).labels)<br></pre><pre>if __name__ == &#39;__main__&#39;:<br>	main()</pre><p>We can now run our app from our terminal using</p><pre>streamlit run app.py</pre><p>Our app will automatically be opened on the expected localhost in our browser.</p><p>To conclude <strong>spacy_streamlit</strong> makes it quite easier to visualize interesting NLP takes with just simple code. Awesome work by @ines from Explosion AI.</p><p>You can also check out the video tutorial on <a href="https://youtu.be/zBSze1elKRQ">youtube</a>.</p><p><strong>Happy Coding!!</strong></p><p><strong><em>Thanks for your time.</em></strong></p><p><strong><em>Jesus Saves</em></strong></p><p><strong><em>By Jesse E.Agbe(JCharis)</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35238abab9f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Cleaning — A Practical Example with Coronavirus Dataset Using Pandas and Schedule For…]]></title>
            <link>https://medium.com/@jcharistech/data-cleaning-a-practical-example-with-coronavirus-dataset-using-pandas-and-schedule-for-14abf485c881?source=rss-6e2e555bfcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/14abf485c881</guid>
            <category><![CDATA[data-cleaning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[coronavirus]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Jesse JCharis]]></dc:creator>
            <pubDate>Fri, 06 Mar 2020 05:46:28 GMT</pubDate>
            <atom:updated>2020-03-06T05:46:28.372Z</atom:updated>
            <content:encoded><![CDATA[<h3>Data Cleaning — A Practical Example with Coronavirus Dataset Using Pandas and Schedule For Automatic Updates.</h3><p>In a<a href="https://www.youtube.com/watch?v=k-d27B5hnqc"> previous tutorial</a> we saw how to do an analysis of the coronavirus (covid19) outbreak using the dataset fetched from John Hopkins on Github. In this section we will see how to automatically fetch the new updated data daily ,prepare and clean the dataset for further analysis.</p><p>Since this is an ongoing study and new data are being collected and added daily it will be best for us to automate the process of fetching the data and cleaning the data.</p><p>We will be using two important python packages to help us achieve our aim — pandas and schedule.</p><p>Our main aim and task involves;</p><ul><li>Fetching the Dataset</li><li>Cleaning and Preparing the Dataset</li><li>How to Automate the entire process for daily updates</li></ul><p><strong>Fetching the Dataset</strong></p><p>Our datasource is from<a href="https://github.com/CSSEGISandData"> this repo</a> on Github which seems to be from John Hopkins university. Based on their terms of use, it is strictly for public use in academic or research purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*LztnUKaZ14z7W9QC.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*lxfXVr2qItPAhyDq.png" /></figure><p>Okay, let us see how to fetch our dataset. There are several way we can do that.</p><p><strong>Using Git</strong></p><p>We can clone the entire repository using git or git-python(a python wrapper for git) and then use the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*xYy22eA5z65ZxPP4.png" /></figure><pre>git clone <a href="https://github.com/CSSEGISandData/COVID-19.git">https://github.com/CSSEGISandData/COVID-19.git</a></pre><p><strong>Using Pandas</strong></p><p>With pandas you can actually get access to any dataset remotely and use it in your analysis by providing the direct URL path to your dataset. So in this case we will be using pandas read_csv() function to fetch our dataset. There will be 3 datasets we will be retrieving from github — <em>Confirmed,Recovered and Deaths</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*wjZZ8ieqG4gAAgPa.png" /></figure><pre>confirmed_cases_url = &quot;https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv&quot;</pre><pre>recovered_cases_url =&quot;https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Recovered.csv&quot;</pre><pre>death_cases_url =&quot;https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Deaths.csv&quot;</pre><p>We can then pass in to our read_csv() function our url.</p><pre>import pandas as pd</pre><pre>df = pd.read_csv(confirmed_cases_url)</pre><p>After we have fetched our datasets we can then proceed to do our data cleaning or preparation.</p><p><strong>Cleaning and Preparing Our Dataset</strong></p><p>From previewing the dataset it looks like it is a timeseries sort of dataset hence we will need to restructure and reshape them to a format that we can easily analyse. We will be using pandas to melt it from a horizontal timeseries to a vertical timeseries as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*18YCZKnY_tjV0P4O.png" /></figure><pre>def get_n_melt_data(data_url,case_type):<br>    df = pd.read_csv(data_url)<br>    melted_df = df.melt(id_vars=[&#39;Province/State&#39;, &#39;Country/Region&#39;, &#39;Lat&#39;, &#39;Long&#39;])<br>    melted_df.rename(columns={&quot;variable&quot;:&quot;Date&quot;,&quot;value&quot;:case_type},inplace=True)<br>    return melted_df</pre><p>We will then join or merge our three dataset together using join. You can also use merge for the same purpose.</p><pre>def merge_data(confirm_df,recovered_df,deaths_df):<br>	new_df = confirm_df.join(recovered_df[&#39;Recovered&#39;]).join(deaths_df[&#39;Deaths&#39;])<br>	return new_df</pre><p>Then we can then save our dataset and use it for our analysis.</p><p><strong>How to Automate the Process</strong></p><p>Since our dataset is updated almost daily it will be convenient to automate our process and schedule the entire task . Remember the famous rule of <strong><em>DRY — Don’t Repeat Yourself</em></strong>. If any task contains repetitive and predictable steps we can automate them to save our time.</p><p>We will be using <strong>schedule</strong> a python package for scheduling task — to automatically schedule our downloads and data cleaning task daily.</p><p>First of all let us install schedule</p><pre>pip install schedule</pre><p>With schedule you schedule any function per specific time or date just like with cron.</p><p>We will create a file “<strong>fetch_covid_data.py”</strong> and then put in all our code.</p><p>We will put all our task into a single function and then use it in schedule as below.</p><pre>import time<br>import pandas as pd <br>import schedule<br>timestr = time.strftime(&quot;%Y%m%d-%H%M%S&quot;)</pre><pre>def fetch_data():<br>	&quot;&quot;&quot;Fetch and Prep&quot;&quot;&quot;<br>	confirm_df = get_n_melt_data(confirmed_cases_url,&quot;Confirmed&quot;)<br>	recovered_df = get_n_melt_data(recovered_cases_url,&quot;Recovered&quot;)<br>	deaths_df = get_n_melt_data(death_cases_url,&quot;Deaths&quot;)<br>	print(&quot;Merging Data&quot;)<br>	final_df = merge_data(confirm_df,recovered_df,deaths_df)<br>	print(&quot;Preview Data&quot;)<br>	print(final_df.tail(5))<br>	filename = &quot;covid19_merged_dataset_updated_{}.csv&quot;.format(timestr)<br>	print(&quot;Saving Dataset as {}&quot;.format(filename))<br>	final_df.to_csv(filename,index=&#39;False&#39;)<br>	print(&quot;Finished&quot;)</pre><pre>schedule.every().day.at(&quot;11:59&quot;).do(fetch_data)<br>while True:<br>   schedule.run_pending()<br>   time.sleep(1)</pre><p>We can then run the script daily to do the entire process.</p><p>You can check the video tutorial <a href="https://www.youtube.com/watch?v=ox6VrgjdZ7s&amp;t=888s">here</a>.</p><p>To conclude we have seen how to fetch our data from a remote source, restructure and clean them and then automate and schedule the entire process. You can also convert this into a CLI if you want. To learn more about <a href="https://www.udemy.com/course/building-command-line-tools-with-pythonjavascript-and-julia/?referralCode=CFC509606F531B63EA85">building CLI</a> for such task you can check out this <a href="https://www.udemy.com/course/building-command-line-tools-with-pythonjavascript-and-julia/?referralCode=CFC509606F531B63EA85">resource</a>.</p><p><strong><em>Thanks for your time and attention</em></strong></p><p><strong><em>Jesus Saves</em></strong></p><p><strong><em>By Jesse E.Agbe(JCharis)</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14abf485c881" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building A Document Redactor NLP App with Streamlit,Spacy and Python]]></title>
            <link>https://medium.com/@jcharistech/building-a-document-redactor-nlp-app-with-streamlit-spacy-and-python-39b94de474b?source=rss-6e2e555bfcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/39b94de474b</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[document-redaction]]></category>
            <category><![CDATA[machine-learning-web-apps]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <dc:creator><![CDATA[Jesse JCharis]]></dc:creator>
            <pubDate>Sat, 14 Dec 2019 14:42:47 GMT</pubDate>
            <atom:updated>2019-12-14T15:11:21.252Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*ZrwvtMOGluPPW3Q9.png" /></figure><p>In this tutorial we will be building a document redaction app. Document redaction refers to the process of sanitizing and censoring a document based on selected terms. It is one of the applications of NLP — natural language processing.</p><p>This image shows some of it use. In this case the important terms have been blacked out or censored.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/187/0*OH_joOO2AVDAg_uK.jpg" /></figure><p>We will be learning how to use spacy’s named entities recognition to perform document redaction and censorship. The basic approach is as follows</p><ul><li>Extract Named Entities with SpaCy</li><li>Select The Entity Type we want to sanitize</li><li>Replace the Selected Token with [‘REDACTED’]</li><li>Join The Tokenized Text together.</li></ul><p>Let us see what we will be building</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*GRehenHAfGUHpj-W.png" /></figure><p><strong>For more on building NLP and ML web apps you can check out these links.</strong></p><p><a href="https://www.udemy.com/course/building-machine-learning-web-apps-with-python/?referralCode=0708D7CBFE0B755E3869">Udemy Course : Building ML Web Apps</a><br><a href="http://bit.ly/2XBQBCc">Get More Here : Building ML Web Apps(Mega Course)</a></p><p><em>Let us begin</em></p><p><strong>Installation</strong></p><p>We will be using the following packages</p><pre>pip install streamlit spacy</pre><p>To begin with, we will import our necessary packages.</p><pre># Core Packages <br>import streamlit as st <br>import os <br>import base64 </pre><pre>#NLP Pkgs <br>import spacy <br>from spacy import displacy <br>nlp = spacy.load(&#39;en&#39;) </pre><pre># Time Pkg import time <br>timestr = time.strftime(&quot;%Y%m%d-%H%M%S&quot;)</pre><p>We will have individual functions to sanitize our text based on the term we select and a function to write our result to a file as well as one to make our saved result downloadable.</p><p>For rendering the Named Entities we will wrap it within an html tag template as below</p><pre>HTML_WRAPPER = &quot;&quot;&quot;&lt;div style=&quot;overflow-x: auto; border: 1px solid #e6e9ef; border-radius: 0.25rem; padding: 1rem&quot;&gt;{}&lt;/div&gt;&quot;&quot;&quot;</pre><p>This is to add beauty and style to our named entities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*ZlCrJvWO3C4buf_t.png" /></figure><pre># Functions to Sanitize and Redact <br>def sanitize_names(text):<br>    docx = nlp(text)<br>    redacted_sentences = []<br>    for ent in docx.ents:<br>        ent.merge()<br>    for token in docx:<br>        if token.ent_type_ == &#39;PERSON&#39;:<br>            redacted_sentences.append(&quot;[REDACTED NAME]&quot;)<br>        else:<br>            redacted_sentences.append(token.string)<br>    return &quot;&quot;.join(redacted_sentences)</pre><pre>def sanitize_places(text):<br>    docx = nlp(text)<br>    redacted_sentences = []<br>    for ent in docx.ents:<br>        ent.merge()<br>    for token in docx:<br>        if token.ent_type_ == &#39;GPE&#39;:<br>            redacted_sentences.append(&quot;[REDACTED PLACE]&quot;)<br>        else:<br>            redacted_sentences.append(token.string)<br>    return &quot;&quot;.join(redacted_sentences)</pre><pre>def sanitize_date(text):<br>    docx = nlp(text)<br>    redacted_sentences = []<br>    for ent in docx.ents:<br>        ent.merge()<br>    for token in docx:<br>        if token.ent_type_ == &#39;DATE&#39;:<br>            redacted_sentences.append(&quot;[REDACTED DATE]&quot;)<br>        else:<br>            redacted_sentences.append(token.string)<br>    return &quot;&quot;.join(redacted_sentences)</pre><pre>def sanitize_org(text):<br>    docx = nlp(text)<br>    redacted_sentences = []<br>    for ent in docx.ents:<br>        ent.merge()<br>    for token in docx:<br>        if token.ent_type_ == &#39;ORG&#39;:<br>            redacted_sentences.append(&quot;[REDACTED]&quot;)<br>        else:<br>            redacted_sentences.append(token.string)<br>    return &quot;&quot;.join(redacted_sentences)</pre><pre>def writetofile(text,file_name):<br>   with open(os.path.join(&#39;downloads&#39;,file_name),&#39;w&#39;) as f:<br>     f.write(text)<br>   return file_name</pre><pre>def make_downloadable(filename):<br>  readfile = open(os.path.join(&quot;downloads&quot;,filename)).read()<br>  b64 = base64.b64encode(readfile.encode()).decode()<br>  href = &#39;&lt;a href=&quot;data:file/readfile;base64,{}&quot;&gt;Download File  File&lt;/a&gt; (right-click and save as &amp;lt;some_name&amp;gt;.txt)&#39;.format(b64)<br>  return href</pre><pre><a href="http://twitter.com/st">@st</a>.cache<br>def render_entities(rawtext):<br>  docx = nlp(rawtext)<br>  html = displacy.render(docx,style=&quot;ent&quot;)<br>  html = html.replace(&quot;\n\n&quot;,&quot;\n&quot;)<br>  result = HTML_WRAPPER.format(html)<br>  return result</pre><p>Do make the download work we will be using <strong><em>st.markdown()</em></strong> and set <em>unsafe_allow_html</em> to True.</p><p>Since for now there is no file download option for streamlit hence we will use a workaround made by @MarcSkovMadsen of<a href="https://awesome-streamlit.org/"> awesomestreamlit.org</a>.</p><p>He utilized base64 and html anchor tags to make this work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*y71eL42dnsvGMmZa.png" /></figure><p>Then we will create a main function in which we will include all our activities. We will have three main activities in our sidebar- Redaction,Downloads and About.</p><p>The entire code for the main function is as follows.</p><pre>def main():<br> &quot;&quot;&quot;Document Redaction with Streamlit&quot;&quot;&quot;<br> st.title(&quot;Document Redactor App&quot;)<br> st.text(&quot;Built with Streamlit and SpaCy&quot;)</pre><pre>activities = [&quot;Redaction&quot;,&quot;Downloads&quot;,&quot;About&quot;]<br> choice = st.sidebar.selectbox(&quot;Select Choice&quot;,activities)</pre><pre>if choice == &#39;Redaction&#39;:<br>  st.subheader(&quot;Redaction of Terms&quot;)</pre><pre>rawtext = st.text_area(&quot;Enter Text&quot;,&quot;Type Here&quot;)<br>  redaction_item = [&quot;names&quot;,&quot;places&quot;,&quot;org&quot;,&quot;date&quot;]<br>  redaction_choice = st.selectbox(&quot;Select Item to Censor&quot;,redaction_item)<br>  save_option = st.radio(&quot;Save to File&quot;,(&quot;Yes&quot;,&quot;No&quot;))<br>  if st.button(&quot;Submit&quot;):<br>   if save_option == &#39;Yes&#39;:<br>    if redaction_choice == &#39;redact_names&#39;:<br>     result = sanitize_names(rawtext)<br>    elif redaction_choice == &#39;places&#39;:<br>     result = sanitize_places(rawtext)<br>    elif redaction_choice == &#39;date&#39;:<br>     result = sanitize_date(rawtext)<br>    elif redaction_choice == &#39;org&#39;:<br>     result = sanitize_org(rawtext)<br>    else:<br>     result = sanitize_names(rawtext)<br>    st.subheader(&quot;Original Text&quot;)<br>    new_docx = render_entities(rawtext)<br>    st.markdown(new_docx,unsafe_allow_html=True)</pre><pre>st.subheader(&quot;Redacted Text&quot;)</pre><pre>st.write(result)<br>    file_to_download = writetofile(result,file_name)</pre><pre>st.info(&quot;Saved Result As :: {}&quot;.format(file_name))<br>    d_link = make_downloadable(file_to_download)<br>    st.markdown(d_link,unsafe_allow_html=True)</pre><pre>else:<br>    if redaction_choice == &#39;redact_names&#39;:<br>     result = sanitize_names(rawtext)<br>    elif redaction_choice == &#39;places&#39;:<br>     result = sanitize_places(rawtext)<br>    elif redaction_choice == &#39;date&#39;:<br>     result = sanitize_date(rawtext)<br>    elif redaction_choice == &#39;org&#39;:<br>     result = sanitize_org(rawtext)<br>    else:<br>     result = sanitize_names(rawtext)</pre><pre>st.write(result)</pre><pre>elif choice == &#39;Downloads&#39;:<br>  st.subheader(&quot;Downloads List&quot;)<br>  files = os.listdir(os.path.join(&#39;downloads&#39;))<br>  file_to_download = st.selectbox(&quot;Select File To Download&quot;,files)<br>  st.info(&quot;File Name: {}&quot;.format(file_to_download))<br>  d_link = make_downloadable(file_to_download)<br>  st.markdown(d_link,unsafe_allow_html=True)</pre><pre>elif choice == &#39;About&#39;:<br>  st.subheader(&quot;About The App &amp; Credits &quot;)</pre><pre>st.text(&quot;MarcSkovMadsen <a href="http://twitter.com/awesomestreamlit">@awesomestreamlit</a>.org&quot;)<br>  st.text(&quot;Adrien Treuille <a href="http://twitter.com/streamlit">@streamlit</a>&quot;)<br>  st.text(&quot;Jesse E.Agbe <a href="http://twitter.com/JCharisTech">@JCharisTech</a>&quot;)</pre><pre>st.success(&quot;Jesus Saves@JCharisTech&quot;)</pre><pre>if __name__ == &#39;__main__&#39;:<br> main()</pre><p>You can then run the app with</p><pre>streamlit run app.py</pre><p>Viola, <a href="https://streamlit.io/">Streamlit</a> makes it easy to build a production ready NLP app with ease</p><p>You can also check the video tutorial on<a href="https://youtu.be/y1UNZZwB5FA"> youtube</a>.</p><p>Thanks For Your Time.</p><p><em>Originally published at </em><a href="https://blog.jcharistech.com/2019/12/14/building-a-document-redactor-nlp-app-with-streamlitspacy-and-python/"><em>https://blog.jcharistech.com</em></a><em> on December 14, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39b94de474b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Predicting Authors of Bible Passages with Machine Learning (Author Attribution)]]></title>
            <link>https://medium.com/@jcharistech/predicting-authors-of-bible-passages-with-machine-learning-author-attribution-25bdbd02da7d?source=rss-6e2e555bfcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/25bdbd02da7d</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[christianity]]></category>
            <category><![CDATA[bible-author-attribution]]></category>
            <category><![CDATA[text-classification]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Jesse JCharis]]></dc:creator>
            <pubDate>Tue, 01 Oct 2019 13:10:09 GMT</pubDate>
            <atom:updated>2019-10-01T13:10:09.491Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*S14M3VpzeEqkxt1IcKG6qQ.png" /></figure><p>Machine learning and AI have impacted the way we do things in this era, almost every industry can benefit from ML.</p><p>In this article we will see how to use ML to predict the particular author of a bible passage. This is a build up of the <a href="https://www.youtube.com/watch?v=exP0oyPEVwU&amp;t=79s">previous tutorial</a> we did some time ago on predicting the location of bible verses (whether they are in Old Testament or New Testament).</p><p>We will use machine learning to do author attribution of bible passages. So what are the applications of this idea, we can use this for</p><ul><li>Identifying Authors(Author Attribution)</li><li>Finding Pliagiarism</li><li>etc</li></ul><p>We will be using Scikit Learn to do our ML text classification and pandas to do our data pre-processing.</p><p>The main idea involves</p><ul><li>Prepare our data-set using Pandas.</li><li>Map each book to their respective author using pandas and map.</li><li>Convert our text to vectors with CountVectorizer or Tfidfvectorizer from Scikit Learn.</li><li>Using Naive Bayes or Logistic Regression Classifier to do the classification</li></ul><p>Let us see the code below</p><p>In [1]:</p><pre># Load EDA Pkgs<br>import pandas as pd<br>import numpy as np</pre><p>In [2]:</p><pre># Load ML Pkgs<br>from sklearn.naive_bayes import MultinomialNB<br>from sklearn.linear_model import LogisticRegression<br>from sklearn.feature_extraction.text import CountVectorizer<br>from sklearn.model_selection import train_test_split<br>from sklearn.metrics import accuracy_score</pre><p>In [3]:</p><pre># Load Dataset<br>df = pd.read_csv(&quot;kjvdata.csv&quot;)</pre><p>In [4]:</p><pre>df.head()</pre><p>Out[4]:</p><p>Unnamed: 0idbookchapterversetext001001001Genesis11In the beginning God created the heaven and th…111001002Genesis12And the earth was without form, and void; and …221001003Genesis13And God said, Let there be light: and there wa…331001004Genesis14And God saw the light, that it was good: and G…441001005Genesis15And God called the light Day, and the darkness…</p><p>In [5]:</p><pre># Authors List<br>author_list = {&quot;Genesis&quot;: &quot;Moses&quot;,<br>&quot;Exodus&quot;: &quot;Moses&quot;,<br>&quot;Leviticus&quot;: &quot;Moses&quot;,<br>&quot;Numbers&quot;: &quot;Moses&quot;,<br>&quot;Deuteronomy&quot;: &quot;Moses&quot;,<br>&quot;Joshua&quot;: &quot;Joshua&quot;,<br>&quot;Judges&quot;: &quot;Samuel, Nathan, Gad&quot;,<br>&quot;Ruth&quot;: &quot;Samuel, Nathan, Gad&quot;,<br>&quot;1 Samuel (1 Kings)&quot;: &quot;Samuel, Nathan, Gad&quot;,<br>&quot;2 Samuel (2 Kings)&quot;: &quot;Samuel, Nathan, Gad&quot;,<br>&quot;1 Kings (3 Kings)&quot;: &quot;Jeremiah&quot;,<br>&quot;2 Kings (4 Kings)&quot;: &quot;Jeremiah&quot;,<br>&quot;1 Chronicles&quot;: &quot;Ezra&quot;,<br>&quot;2 Chronicles&quot;: &quot;Ezra&quot;,<br>&quot;Ezra&quot;: &quot;Ezra&quot;,<br>&quot;Nehemiah&quot;: &quot;Nehemiah, Ezra&quot;,<br>&quot;Esther&quot;: &quot;Mordecai&quot;,<br>&quot;Job&quot;: &quot;Job,Moses&quot;,<br>&quot;Psalms&quot;: &quot;David,Asaph, Ezra, the sons of Korah, Heman, Ethan, Moses&quot;,<br>&quot;Proverbs&quot;: &quot;Solomon ,Agur(30) and Lemuel(31)&quot;,<br>&quot;Ecclesiastes&quot;: &quot;Solomon&quot;,<br>&quot;Song of Solomon (Canticles)&quot;: &quot;Solomon&quot;,<br>&quot;Isaiah&quot;: &quot;Isaiah&quot;,<br>&quot;Jeremiah&quot;: &quot;Jeremiah&quot;,<br>&quot;Lamentations&quot;: &quot;Jeremiah&quot;,<br>&quot;Ezekiel&quot;: &quot;Ezekiel&quot;,<br>&quot;Daniel&quot;: &quot;Daniel&quot;,<br>&quot;Hosea&quot;: &quot;Hosea&quot;,<br>&quot;Joel&quot;: &quot;Joel&quot;,<br>&quot;Amos&quot;: &quot;Amos&quot;,<br>&quot;Obadiah&quot;: &quot;Obadiah&quot;,<br>&quot;Jonah&quot;: &quot;Jonah&quot;,<br>&quot;Micah&quot;: &quot;Micah&quot;,<br>&quot;Nahum&quot;: &quot;Nahum&quot;,<br>&quot;Habakkuk&quot;: &quot;Habakkuk&quot;,<br>&quot;Zephaniah&quot;: &quot;Zephaniah&quot;,<br>&quot;Haggai&quot;: &quot;Haggai&quot;,<br>&quot;Zechariah&quot;: &quot; Zechariah&quot;,<br>&quot;Malachi&quot;: &quot;Malachi&quot;,<br>&quot;Matthew&quot;: &quot;Matthew&quot;,<br>&quot;Mark&quot;: &quot;John Mark&quot;,<br>&quot;Luke&quot;: &quot;Luke&quot;,<br>&quot;John&quot;: &quot;John, the Apostle&quot;,<br>&quot;Acts&quot;: &quot;Luke&quot;,<br>&quot;Romans&quot;: &quot;Paul&quot;,<br>&quot;1 Corinthians&quot;: &quot;Paul&quot;,<br>&quot;2 Corinthians&quot;: &quot;Paul&quot;,<br>&quot;Galatians&quot;: &quot;Paul&quot;,<br>&quot;Ephesians&quot;: &quot;Paul&quot;,<br>&quot;Philippians&quot;: &quot;Paul&quot;,<br>&quot;Colossians&quot;: &quot;Paul&quot;,<br>&quot;1 Thessalonians&quot;: &quot;Paul&quot;,<br>&quot;2 Thessalonians&quot;: &quot;Paul&quot;,<br>&quot;1 Timothy&quot;: &quot;Paul&quot;,<br>&quot;2 Timothy&quot;: &quot;Paul&quot;,<br>&quot;Titus&quot;: &quot;Paul&quot;,<br>&quot;Philemon&quot;: &quot;Paul&quot;,<br>&quot;Hebrews&quot;: &quot;Paul, Luke, Barnabas, Apollos&quot;,<br>&quot;James&quot;: &quot;James the brother of Jesus and Jude (not the Apostle, brother of John).&quot;,<br>&quot;1 Peter&quot;: &quot;Peter&quot;,<br>&quot;2 Peter&quot;: &quot;Peter&quot;,<br>&quot;1 John&quot;: &quot;John, the Apostle&quot;,<br>&quot;2 John&quot;: &quot;John, the Apostle&quot;,<br>&quot;3 John&quot;: &quot;John, the Apostle&quot;,<br>&quot;Jude&quot;: &quot;Jude, the brother of Jesus&quot;,<br>&quot;Revelation&quot;: &quot;John, the Apostle&quot;}</pre><p>In [7]:</p><pre>df[&#39;author&#39;] = df[&#39;book&#39;].map(author_list)</pre><p>In [8]:</p><pre>df[&#39;author&#39;].head()</pre><p>Out[8]:</p><pre>0    Moses<br>1    Moses<br>2    Moses<br>3    Moses<br>4    Moses<br>Name: author, dtype: object</pre><p>In [9]:</p><pre># Features<br>Xfeatures = df[&#39;text&#39;]<br>ylabels = df[&#39;author&#39;]</pre><p>In [10]:</p><pre># Vectorization<br>cv = CountVectorizer()<br>X = cv.fit_transform(Xfeatures)</pre><p>In [13]:</p><pre># Split dataset<br>x_train,x_test,y_train,y_test = train_test_split(X,ylabels,test_size=0.33,random_state=42)</pre><p>In [14]:</p><pre># Shape of X_train<br>x_train.shape</pre><p>Out[14]:</p><pre>(20839, 12590)</pre><p>In [15]:</p><pre># Building Our Model<br>clf = MultinomialNB()<br>clf.fit(x_train,y_train)</pre><p>Out[15]:</p><pre>MultinomialNB(alpha=1.0, class_prior=None, fit_prior=True)</pre><p>In [16]:</p><pre>print(&quot;Accuracy of Model :&quot;,clf.score(x_test,y_test))</pre><pre>Accuracy of Model : 0.5213367108339828</pre><p>In [17]:</p><p># Alternative Method for Checking Accuracy</p><pre>accuracy_score(y_test,clf.predict(x_test))</pre><p>Out[17]:</p><pre>0.5213367108339828</pre><p>In [18]:</p><pre># Logistic Regression<br>logit = LogisticRegression()<br>logit.fit(x_train,y_train)</pre><p>Out[18]:</p><pre>LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,<br>          intercept_scaling=1, max_iter=100, multi_class=&#39;warn&#39;,<br>          n_jobs=None, penalty=&#39;l2&#39;, random_state=None, solver=&#39;warn&#39;,<br>          tol=0.0001, verbose=0, warm_start=False)</pre><p>In [19]:</p><pre>print(&quot;Accuracy of Logit Model :&quot;,logit.score(x_test,y_test))</pre><pre>Accuracy of Logit Model : 0.5966484801247077</pre><p>In [20]:</p><pre># Prediction<br>sample_verse1 = [&quot;And after these things I heard a great voice of much people in heaven, saying, Alleluia; Salvation, and glory, and honour, and power, unto the Lord our God:For true and righteous are his judgments: for he hath judged the great whore, which did corrupt the earth with her fornication, and hath avenged the blood of his servants at her hand.&quot;]<br># Rev/John<br>sample_verse2 = [&quot;Now in the first year of Cyrus king of Persia, that the word of the Lord by the mouth of Jeremiah might be fulfilled, the Lord stirred up the spirit of Cyrus king of Persia, that he made a proclamation throughout all his kingdom, and put it also in writing, saying,Thus saith Cyrus king of Persia, The Lord God of heaven hath given me all the kingdoms of the earth; and he hath charged me to build him an house at Jerusalem, which is in Judah.Who is there among you of all his people? his God be with him, and let him go up to Jerusalem, which is in Judah, and build the house of the Lord God of Israel, (he is the God,) which is in Jerusalem&quot;]<br># Ezra/Ezra<br>sample_verse3 = [&quot;Jesus wept&quot;]<br>#John/John</pre><p>In [21]:</p><pre># Vectorize them before predicting<br>vect = cv.transform(sample_verse1).toarray()</pre><p>In [22]:</p><pre># Shows how the vectors are<br>vect</pre><p>Out[22]:</p><pre>array([[0, 0, 0, ..., 0, 0, 0]], dtype=int64)</pre><p>In [23]:</p><pre># Single Prediction<br>clf.predict(vect)</pre><p>Out[23]:</p><pre>array([&#39;John, the Apostle&#39;], dtype=&#39;&lt;U71&#39;)</pre><p>In [24]:</p><pre>logit.predict(vect)</pre><p>Out[24]:</p><pre>array([&#39;John, the Apostle&#39;], dtype=object)</pre><p>Our predictions using both models proved accurate. Let us try it on a different<br>data ,i.e a different bible version such as N.I.V.</p><p>In [31]:</p><pre># Using NIV <br>sample_verse4 = [&quot;Therefore, I urge you, brothers and sisters, in view of God’s mercy, to offer your bodies as a living sacrifice, holy and pleasing to God—this is your true and proper worship. 2 Do not conform to the pattern of this world, but be transformed by the renewing of your mind. Then you will be able to test and approve what God’s will is—his good, pleasing and perfect will.&quot;]</pre><p>In [32]:</p><pre>vect4 = cv.transform(sample_verse4).toarray()</pre><p>In [33]:</p><pre># Single Prediction<br>clf.predict(vect4)</pre><p>Out[33]:</p><pre>array([&#39;Paul&#39;], dtype=&#39;&lt;U71&#39;)</pre><p>Wow our prediction was also accurate, that means that our model is not that bad. So we can use<br>Lime or Eli5 to interpret our model from hence forth. To see those part you can check<br>the repo on<a href="https://github.com/Jcharis/Bible-NLP-and-ML-using-Python"> github</a> with the remaining aspects.</p><p>To conclude, we can see how easy it is, to do author attribution and bible author prediction using python and Machine Learning.<br>You can also check the video tutorials on the entire process <a href="https://youtu.be/bMbjDi-JVkY">here</a>.</p><p>Thanks for your time.<br>By Jesse E.Agbe(JCharis)<br>Jesus Saves</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25bdbd02da7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building A Domain Name Generation Web App, CLI and Package]]></title>
            <link>https://medium.com/@jcharistech/building-a-domain-name-generation-web-app-cli-and-package-c16c003c33ca?source=rss-6e2e555bfcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c16c003c33ca</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[building-cli]]></category>
            <category><![CDATA[domain-name-generation]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jesse JCharis]]></dc:creator>
            <pubDate>Thu, 12 Sep 2019 11:45:05 GMT</pubDate>
            <atom:updated>2019-09-12T11:45:05.971Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*Wtixc8YAiK2aIbaT0Wzr-A.png" /><figcaption>Domain Name</figcaption></figure><p>One of the most difficult things to do is getting names for your website or even your business. You may not think this is an issue until you try searching for a name and the domain name is already taken whaaat!! Yeah you will have to try out several options before you can arrive at one you may like.</p><p>So what if we can build a simple app that can automatically generate domain names for us. Let us start with building a line of domain name generation apps. And as I always do we will build one app idea in three or more ways.</p><p>We will build</p><ul><li>a web application</li><li>a command line application(CLI)</li><li>a GUI(in the future)</li><li>a package</li></ul><p>Let us begin.</p><p><strong>The Problem</strong>: Difficulty getting domain name for our site and business</p><p><strong>Our Aim and Solution</strong>: To build a domain name generation application.</p><p><strong>Our Plan</strong>:</p><ul><li>Get a list of all domain name extensions i.e. [.com,org,edu,ai,io]</li><li>Build a system to generate the names with these extensions</li><li>Save our results</li><li>Name our line of apps with a unique name that has not been used.</li><li>Publish and watch</li></ul><p><strong>The Name of Our Apps: DomainGistry</strong></p><p><em>Don’t worry this name has not been taken yet</em></p><h3>Building The Domain Name Generation Web App with Flask and Python</h3><p>Our web app (DomainGistry Web App) will have a front end built with bootstrap and our back-end built with flask.</p><p>Flask is a powerful python micro-framework useful for building web applications with simplicity. Hence we will be using flask for our back-end. You can download flask on your system with</p><p><strong><em>pip install flask</em></strong></p><p>The simple code for the back end can be found <a href="https://github.com/Jcharis/Utility-Apps/tree/master/DomainGistry_Domain_Name_Generator_WebApp">here</a>. For the front-end we will be using bootstrap and this is how it will look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6lI3_giJvvywfwlX0PRs9w.png" /><figcaption>Front End of Domain Name Generation Flask App</figcaption></figure><p>The most important aspect of our app involves how to generate the names and we solved this by</p><ul><li>Iterating through our list of domain extensions using a python <em>for loop</em></li><li>Concatenating it to a our term in a string format.<em>(You can use f-string or string format if you want)</em></li><li>Using a list comprehension to store our results</li><li>Exporting our list to our front end.</li></ul><p>For the Front-End we used bootstrap and created a simple form to receive our term or name.</p><p>So we have built a simple domain name generation web application,You can check the full code here <a href="https://github.com/Jcharis/Utility-Apps/tree/master/DomainGistry_Domain_Name_Generator_WebApp">DomainGistry Web App</a>.</p><p>Let us move on to the next part of building a CLI of the same idea with JavaScript.</p><h3>Building A Domain Name Generation CLI [DomainGistry] with Commander.js and Node.js</h3><p>Unlike our previous app, this is going to be built with JavaScript, [we will build one with CLICK in python for python lovers].</p><p>So what we need is</p><ul><li>Node.js</li><li>Commander.js</li><li>Chalk.js</li></ul><p><a href="https://github.com/tj/commander.js/">Commander.js</a> is a simple to use CLI package that allows us to create command line applications. Of course there are several packages we can use for this same idea, such as caporal.js,vorpal.js gluegun,etc., but we will use commander for now.</p><p>We will use the same idea but in JavaScript.</p><p>You can check out the <a href="https://youtu.be/6piGABbvp5A">full video tutorial</a> on the YouTube channel - <a href="https://youtu.be/6piGABbvp5A">JCharisTech</a></p><p>To use <a href="https://github.com/Jcharis/domaingistry">DomainGistry</a> — Domain Name Generation CLI on your system, you can install it using NPM as follows</p><pre>npm install domaingistry</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dgXIFJhZx29xgkUpS_q49A.png" /><figcaption>DomainGistry CLI For JavaScript</figcaption></figure><p>Feel free to try it out.</p><p>For Python Lovers, you can check out the python version of both the package and the CLI on PyPI with</p><p><strong><em>pip install domaingistry</em></strong></p><p>If you need help working with this app you can contact me.</p><p>Thanks for reading and stay tune for more line of apps.</p><p><strong><em>By Jesse E.Agbe(JCharis)</em></strong></p><p><strong><em>Jesus Saves@JCharisTech</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c16c003c33ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>