Skip to content

litan/kojo-ai-2

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
doc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Kojo-AI

Support for data science, machine learning, and more - within Kojo.

A previous cut of kojo-ai is available at https://github.com/litan/kojo-ai. This is the next cut, based on the official Tensorflow-Java API.

Current Features (work in progress, but functional):

Get Started

To use Kojo-AI within Kojo, just use a published release, or copy artifacts from this repo into the Kojo libk directory as per the following steps:
sbt buildDist
mv ~/.kojo/lite/libk ~/.kojo/lite/libk.bak
cp -var dist ~/.kojo/lite/libk

NST Example

An example showing NST in action is given below:

// #include /nst.kojo

cleari()
clearOutput()

val alpha = 0.8f
val fltr1 = new NeuralStyleFilter("/path/to/savedmodel/", "/path/to/style.jpg", alpha)
// val fltr2 = new NeuralStyleFilter("/path/to/savedmodel/", "/path/to/style2.jpg", alpha)

val drawing = Picture {
    setPenColor(cm.gray)
    var clr = cm.rgba(255, 0, 0, 127) // start with a semi transparent red color
    setPenThickness(8)
    repeat(18) {
        setFillColor(clr)
        repeat(5) {
            forward(100)
            right(72)
        }
        clr = clr.spin(360 / 18) // change color hue
        right(360 / 18)
    }
}

val pic = effect(fltr1) -> drawing
// or apply two filters
// val pic = effect(fltr1) * effect(fltr2) -> drawing

draw(pic)

NST sample images

Original Kojo Drawing:

nst0

Drawing with one NST filter applied:

nst1

Drawing with two NST filters applied:

nst2

About

AI in Kojo via Tensorflow-Java; and more...

Resources

License

Stars

Watchers

Forks

Packages

No packages published