top of page
Search

Github Copilot helped in debugging like an Autopilot in Aircraft — Made my day

Unlocking a great use case to debug codes with the help of Github Copilot



Github Copilot is one of the recent buzzing things at present, keeping aside the burning arguments like,


‘Is copilot blessing or curse?’ ‘What is grace in disguise in copilot?’

Let us today discuss one great use case about copilot that helped me in solving an error which made me stuck for 3 days


First of all to add more clarity to my headline let us just me more clearer about the words Copilot and Autopilot


Copilot:


Just like this, here our Github Copilot also just assists us and definitely cannot take over the aircraft (cannot code completely)


Autopilot:



This do not replace human, but it allows operator (coder) to focus on broader aspects


So before moving into my story let us brush through some topics like what is Github Copilot


Github Copilot:


Github Copilot is a Artificial Intelligence based tool which can be used as a paired programmer allowing coders to autocomplete code in a more efficient way. It was developed by GitHub and OpenAI to assist users of Visual Studio Code, Neovim, and JetBrains. It can be used with many languages like python etc with the use of comment or code itself.


Problem I faced:


A year back I created a code for Carnatic note classifier with Audio Processing and Audio Segmentation as I used many packages in it, they were getting upgraded as days passed so it was running fine in my machine


One fine day when I bought a new laptop and tried running the code there, I was facing so many errors which I tried clearing one by one, but at a point I got stuck I was unable to proceed further as I didn’t get the recent way of using it


I pondered over Stackoverflow for 3 days and still was not able to (not full 3 days though)


So first I cleared a few errors myself on browsing through Stackoverflow



Here instead of predict_classes just .predict did the work


Next Villain (error) entry:



Error with reshaping and output rendering confusion between 1d and 2d arrays


This was the one breaking my head I was trying to do so many things like to reshape the array differently, formatting the array differently to store probabilities of classes, either I was getting this error or my array got stopped with only one class, still nothing could help


Then I just left this code and started working on different things and one fine day our hero came to my inbox


This mail landed in my inbox



The first thought came to my mind is could this help me to resolve my error, so I installed and did setup Copilot with VSCode and headed to my code copy pasted from Jupyter Notebook to VSCode editor


And now our hero came for rescue what I did was I just went on to the error line removed it then started typing the exact variables which was already there and it gave me the suggestions which were already there, now I just did a trick, instead of keeping a same variable like predicted_class, I changed to prediction and it did the work the latest improvement and the correct way of doing it was suggested and when I used that it worked, I was on cloud nine


Previously it was like



After Incorporating Copilot suggestion



This Copilot Suggestion made my day


My final application is live at:



Will be writing another article for taking your Data Science applications live through Streamlit Cloud


Until then, In the pursuit of exploring new potentials recent tech is offering

Commentaires


Post: Blog2_Post
bottom of page