1. BasicNotebook

BasicNotebook

A very basic notebook that displays a message. No AI code, just a demo of the publishing system used. It first prompts the user to upload an image, then resizes it and draws some text.

Code from BasicNotebook.scala:54 executed in 0.00 seconds (0.000 gc):

      implicit val _ = log
      // First, basic configuration so we publish to our s3 site
      log.setArchiveHome(URI.create(s"s3://$s3bucket/${getClass.getSimpleName.stripSuffix("$")}/${log.getId}/"))
      log.onComplete(() => upload(log): Unit)
      // Now we evaluate the drawing code inside a logged eval block.
      // This will publish the code, the result, any logs, the duration, and also link to github.
      val canvas = log.eval(() => {
        val canvas = ImageArtUtil.load(log, styleUrl, resolution.toInt)
        val graphics = canvas.getGraphics.asInstanceOf[Graphics2D]
        graphics.setFont(new Font("Calibri", Font.BOLD, 42))
        graphics.drawString(message, 10, 50)
        canvas
      })
      // Usually not on one line, this code publishes our result to the site's index so it is linked from the homepage.
      registerWithIndexJPG(Tensor.fromRGB(canvas)).foreach(_.stop()(s3client, ec2client))
      null
    }

Returns:

    <function0>

Code from BasicNotebook.scala:61 executed in 176.86 seconds (0.284 gc):

    val canvas = ImageArtUtil.load(log, styleUrl, resolution.toInt)
    val graphics = canvas.getGraphics.asInstanceOf[Graphics2D]
    graphics.setFont(new Font("Calibri", Font.BOLD, 42))
    graphics.drawString(message, 10, 50)
    canvas

Logging:

    <a id="p-5"></a><iframe src=input_b5e612c1-f34e-409b-b32a-8c3218a29e66.html style="margin: 0px; resize: both; overflow: auto; width: 100%; height: 90px;"></iframe>
    
    THREADS = 64
    DEBUG_LIFECYCLE = false
    DOUBLE_CACHE_MODE = WEAK
    Initialized RefSettings = {
      "doubleCacheMode" : "WEAK"
    }
    

Returns:

Result