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)
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)
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())
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())
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')
import moxel model = moxel.Model('maya/acronyms:latest', where='localhost') output = model.predict( sentence = 'NASA is an aeronautical space company' ) print(output['results'])
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)
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 ))