Exemplo n.º 1
0
import moxel

model_vgg = moxel.Model('strin/coco-vgg:latest')
model_caption = moxel.Model('strin/coco-caption:latest')
model_story_romantic = moxel.Model('strin/story-romantic:latest')


def predict(image):
    feats = model_vgg.predict(image=image)['feats']
    captions = model_caption.predict(feats=feats)['sentences'].to_object()
    return model_story_romantic.predict(sentences=captions)
Exemplo n.º 2
0
import moxel

model = moxel.Model('moxel/awesome:latest', where='localhost')

image = moxel.space.Image.from_file('volkswagen.jpg')

result = model.predict(image=image)

print('result', result)
Exemplo n.º 3
0
import moxel

model = moxel.Model('strin/coco-vgg:latest')
image = moxel.space.Image.from_file('images/ex2.jpg')
result = model.predict(image=image)['feats']
print(result.to_numpy())
Exemplo n.º 4
0
import moxel
# Does it feel better to be "moxel.Image"
from moxel.space import Image

model = moxel.Model('strin/vgg19:latest', where='localhost')

# Ping the model to see if it works.
ok = model.ping()
print('ok', ok)

# Make a prediction.
img = Image.from_file('example/rock.jpg')
results = model.predict({'image': img})

print(results['feature'].to_numpy())
Exemplo n.º 5
0
import moxel

model = moxel.Model('strin/colorization:latest', where='localhost')

img_in = moxel.space.Image.from_file('demo/imgs/ansel_adams3.jpg')

result = model.predict(img_in=img_in)

img_out = result['img_out'].to_PIL().save('output.png')
Exemplo n.º 6
0
import moxel

model = moxel.Model('maya/acronyms:latest', where='localhost')

output = model.predict(
    sentence = 'NASA is an aeronautical space company'
)

print(output['results'])
Exemplo n.º 7
0
import moxel
import json
import numpy

model = moxel.Model('strin/story-romantic:latest', where='localhost')

sentences = [
    u'A black and white photo of a man in suit and tie .',
    u'a large clock on the wall above a radiator',
    u'A young girl and a woman preparing food in a kitchen .',
    u'a close up of a person grabbing a pastry in a container',
    u"A woman glances at a young girl 's cooking on the stovetop"
]
passage = model.predict(sentences=sentences)['passage']

print('passage', passage)
Exemplo n.º 8
0
import os
import moxel
from moxel.space import Image

model = moxel.Model('jimfan/squeezenet:latest', where='localhost')
for img in os.listdir('demo_imgs'):
    img = os.path.join('demo_imgs', img)
    Image.from_file(img)
    output = model.predict(img=Image.from_file(img))
    print('query "{}" -> {}'.format( img, output ))