Trying to get Talk to the City to work with [Google Colab

Talk to the City Scatter on Google Colab

Reboot required after pip install

  • image
  • Due to numpy installation
  • I rebooted and re-ran from the top and it works.

The part where you put the OpenAI API key in the environment variable and the part where main.py asks for interactive operations is troublesome.

Put the OpenAI API key into an environment variable

import getpass, os
OPENAI_API_KEY = getpass.getpass("input OPENAI_API_KEY")
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
  • It’s done.
    • It asks you interactively and you type it in.

main.py asks for interactive operations.

  • nishio.iconThe tool I run in Google Colab asks me to Press Enter, what should I do?
  • gpt.icon!echo | <your_command_here>
  • I see. I got it.

execution (e.g. program)

  • image
  • Pipeline completed.

  • It’s done.

How to preview the output static HTML

  • Is it absurd to set up an HTTP server on Google Colab and preview it?
  • Zip it up and have it downloaded?
    • image
    • Even if I download it, I’ll have to set up a local HTTP server to see it after all…

TTTC2024-08-20 Cybozu Lab Youth Summer Camp 2024


This page is auto-translated from /nishio/TTTCをColabで動かす using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I’m very happy to spread my thought to non-Japanese readers.