Week 3 Lab Notebook
September 2023 (1086 Words, 7 Minutes)
Week 3 Lab Notebook
Stock Simulator Graphs
This is a continuation of the Stock Simulator Math where we instead now display the data on graphs.
Problems:
- Whenever we made the server, the images would not show but they would on VS Code
Solutions:
- Me and Tanay both downloaded the images from VS Code and inserted them with Markdown boxes
Skills used/learned:
- We learned how to use the pandas module and how to plot existing data
Weather Lookup description:
I wanted to have at least one project that used an API key for something, and I decided that doing a weather app would be the most convenient. Using an OpenWeatherMap API key, I was able to fetch weather data from any city that was inputted and display the results.
Problems:
- The JavaScript code was very complex as it had to collect all the input data and form a URL using the API key and all input data so that it could fetch data from the resulting webpage.
- For my first few attempts, the correct link was not able to be formed and would not display data.
Solution:
- I did some research on Stack Overflow and found a simplified version of the code.
- After playing around with the link construction, I was able to find a configuration that worked.
Skills used/learned:
- I learned how to use API Keys to grab data from a source and display it on my webpage.
- I used `JavaScript` functions to automate all of this.
AI Story Generator:
I wanted to use Python to do something with AI, and my idea originally started as an AI Rap song generator, but it wouldn’t rap and would instead provide stories based on a prompt. So using a pre-trained GPT-2 Model, I decided to just let it be a story generator and I gave it a prompt to expand on, and it returned a full story.
Problems:
- This process would take over 15 minutes to generate a full story
- The Python code and model would have a heavy cost on the computer's memory
Solutions:
- I simplified the code as much as I could, and it took only 2 minutes, and the memory usage was bearable
Skills used/learned:
- I learned how to call already existing AI models and create a story from a prompt
- I used `Python` to code complex AI generators
Cube Catcher
I wanted to create a GUI-based 2D JavaScript game, and I decided that a 2D Cube that followed the mouse and collected other cubes was simple yet still required lots of code.
Problems:
- The JavaScript logic wasn't working out the best, and the cube would have a hard time following the mouse pointer
- Falling cubes started spawning outside of the container
Solutions:
- I used a better version of the mouse following logic, and it started working correctly
- I changed the styling so that any overflow of cubes would be hidden
Skills used/learned:
- I learned how to use JavaScript to code a game using complex logic
Linux Script
Since creating Linux interaction is VS Code was on the pair showcase rubric, I decided to create a simple file management script that allows the user to quickly move, copy, delete, or organize their files.
Problems:
- I had to look at several different websites to see how scripts in Linux work
Solutions:
- After looking at sources, I understood how they worked and was able to make a fairly simple script that just did 1 of 4 operations based on user input
Skills used/learned:
- I learned how to write Linux bash scripts
Chat GPT Voice Assistant
I wanted to be able to speak to an AI voice assistant and have it respond with a voice, so I used my OpenAI API key to send a message to Chat GPT and return it. This was possible because of the gTTS
module that turned my question into text that could be sent to ChatGPT and turn GPT’s text response into speech.
Problems:
- I originally tried to use PyAudio to transcribe and speak the text, but PyAudio was not working as I could not install it.
Solutions:
- I switched to gTTS to transcribe the input and speak the response
Skills used/learned:
- I learned how to use the gTTS module to turn my speech into text for GPT and turn its response into speech
- I learned how to use my OpenAI API Key to use AI in Python code
Stacker
I wanted to create one of those arcade stacker games but didn’t know where to start, so I did some research and found a Youtube Tutorial that explained how to use the P5 library to create the game. I followed the tutorial step by step and made a similar product to what is in the video. I also added a start and stop button.
Problems:
- I didn't know what to do to start making the game
Solutions:
- I found a tutorial that showed me how to make the game
Skills used/learned:
- I learned what P5 js library is and how to use it to make creative games