Week 10: Section Activity

  • Due Apr 9 at 5pm
  • Points 10
  • Questions 1
  • Available after Apr 7 at 12am
  • Time Limit None

Instructions

For all section activities, please sit next to a partner and work together but be sure to do all the steps on your own computer.

Activity 1: Data exploration

Ask ChatGPT to search the web to find downloadable data for the Health Inequality Project. You should find a link to a page with a list of data tables. Download the CSV files #11 (life expectancy by county) and #12 (county characteristics)

Upload those two CSV files into ChatGPT and ask it to describe the data in those files. You now have 3 data analysis goals:

  1. Ask it to add a column with calculated average life expectancy for each county (instead of broken down by income and gender). Remind it that the populations of each group are also included in the life expectancy data.
  2. Ask to identify county characteristics that are strongly correlated with average life expectancy. Note that the characteristics are in a separate file from life expectancy.
  3. Pick one of those characteristics and ask for a scatterplot that shows the correlation.

Finally, engage in some policy exploration with ChatGPT. Can you identify some policy interventions that might help improve life expectancy in counties that have lower than average life expectancy?

Activity 2: Multimodal API access

Your TF will give you access to an API key that you can use for section.

Download these two notebooks from Canvas: ImageGen.ipynb Download ImageGen.ipynb and TextToSpeech.ipynb Download TextToSpeech.ipynb. Upload each of them into Google Colab.

Run each of the notebooks to see what else you can do with the API! You'll need to make your Colab secret API key available to each notebook. You can edit these notebooks as well. For instance, try using dall-e-2 as the image generator to see a very early example of this image generation technology. Also note that with dall-e-3 the API revises and expands your prompt—you can see the revised prompt after the image is created.

Activity 3: Combining code generation with API access

Make a new, blank Jupyter notebook in Colab. Name the notebook "Summarizer.ipynb"

In Colab, create a new folder called "Lectures" and upload some of the PDFs of our GenEd 1188 lectures into that folder. If you want to upload all of the lectures, you can get them from this zip file (you may need to unzip the file after downloading): lectures_2025.zip Download lectures_2025.zip

Your task is to create a Python script that will find the PDF files from the Lectures folder, open each of the file, extract the text, and summarize each file by using the OpenAI API. It's extremely unlikely that this will work the first time—our goal is for you to try to figure out how to fix the problems by going back and forth between the Python code and ChatGPT.

We are here to help! This may feel frustrating, but it's realistic—and eventually you should be able to get code that works.

Copy and paste the resulting code in the text box below.

If you manage to get your PDF summarizer working correctly, extend it to make a quiz tool that will ask (and evaluate) multiple-choice questions based on the contents of the PDFs.

Only registered, enrolled users can take graded quizzes