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:66 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:73 executed in 28.71 seconds (0.154 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_d41c908f-b3c7-4269-b64b-961ab2cd285c.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