Deploy an Object-Detection API
Here, we’re using a modified version of the Python code found in this blog post
We are deploying an object-detection API, which will take an image URL as input, and return bounding-boxes of objects detected (in JSON format).
This API utilizes deep-learning models provided by the tensorflow library.
- Deploy it now!
dan@node1:~/deploymenow_client$ dmn deploy sample_app_tf_object_detection.py
.Your application is deployed!
...Now checking if your app is ready
..Everything is ready!
{"url": "https://incremental-cubicle-162479746.deploymenow.com", "message": "your API is ready on our end!...but if you see a 404 in your browser, or an SSL-error, give it a few moments! Your browser may need a moment to catch up :) ..."}- Let’s test it out!
curl -s --header "Content-Type: application/json" --request POST --data '{"img_url": "https://images.pexels.com/photos/310983/pexels-photo-310983.jpeg"}' https://incremental-cubicle-162479746.deploymenow.com
{"detection_boxes": [[0.48979154229164124, 0.2949383556842804, 0.9399409294128418, 0.7534102201461792], [0.28568699955940247, 0.440918505191803, 0.8538385629653931, 0.6902232766151428], [0.6846002340316772, 0.31156548857688904, 0.935225248336792, 0.4780828058719635], [0.7008721232414246, 0.5769227743148804, 0.9357900023460388, 0.7603199481964111], [0.6846002340316772, 0.31156548857688904, 0.935225248336792, 0.4780828058719635], [0.7008721232414246, 0.5769227743148804, 0.9357900023460388, 0.7603199481964111], [0.28335320949554443, 0.4457286596298218, 0.8613533973693848, 0.6890441179275513], [0.789621114730835, 0.05929415673017502, 0.8370417356491089, 0.19611522555351257], [0.7891280651092529, 0.5240554213523865, 0.8615255355834961, 0.5947098135948181], [0.3311082124710083, 0.5157912969589233, 0.6921156644821167, 0.6817193031311035], [0.7388082146644592, 0.4702211320400238, 0.8136313557624817, 0.5494523048400879], [0.7795827388763428, 0.008922167122364044, 0.833983302116394, 0.17885544896125793], [0.8032947182655334, 0.0, 0.8540119528770447, 0.037333711981773376], [0.7096884846687317, 0.2187896966934204, 0.7395961880683899, 0.27634766697883606], [0.295547753572464, 0.17495769262313843, 0.7464452981948853, 0.3560393452644348], [0.28568699955940247, 0.440918505191803, 0.8538385629653931, 0.6902232766151428], [0.7859323024749756, 0.13738486170768738, 0.8318578004837036, 0.21345481276512146], [0.7885904908180237, 0.550367534160614, 0.8573607802391052, 0.6339511275291443], [0.2994905114173889, 0.17670804262161255, 0.7602431178092957, 0.36219900846481323], [0.7579016089439392, 0.02782776951789856, 0.8042100071907043, 0.13558827340602875], [0.7592958211898804, 0.08187499642372131, 0.8050848245620728, 0.16856935620307922], [0.6872466206550598, 0.7126765251159668, 0.7236505150794983, 0.7813172340393066], [0.3327302932739258, 0.4758263826370239, 0.6670325994491577, 0.646894097328186], [0.695273756980896, 0.8414599895477295, 0.7312983274459839, 0.9062167406082153], [0.706959068775177, 0.17021125555038452, 0.7371887564659119, 0.2223537564277649], [0.687074601650238, 0.672951877117157, 0.7364041209220886, 0.7581091523170471], [0.6889437437057495, 0.30392563343048096, 0.9454923868179321, 0.48289692401885986], [0.7423096895217896, 0.5072193741798401, 0.8181825876235962, 0.5808431506156921], [0.7701359987258911, 0.48488956689834595, 0.840448260307312, 0.5480528473854065], [0.8307921290397644, 0.5464968681335449, 0.8769915699958801, 0.596724271774292], [0.7040820717811584, 0.23784053325653076, 0.7400698065757751, 0.3090459108352661], [0.7566551566123962, 0.14799802005290985, 0.803883969783783, 0.24346105754375458], [0.6873270273208618, 0.025052856653928757, 0.7358953952789307, 0.12498266994953156], [0.8244079947471619, 0.0, 0.9002344012260437, 0.01971466839313507], [0.6967613101005554, 0.8702957034111023, 0.7384138703346252, 0.9886419177055359], [0.6387708187103271, 0.24596171081066132, 0.7045185565948486, 0.30727285146713257], [0.6268899440765381, 0.7142831683158875, 0.6849206686019897, 0.7871286273002625], [0.5236576199531555, 0.5099024772644043, 0.8301973938941956, 0.6639717817306519], [0.3157612383365631, 0.017140522599220276, 0.8038437366485596, 0.24502991139888763], [0.37789803743362427, 0.030701495707035065, 0.7494503855705261, 0.20368292927742004], [0.41400647163391113, 0.4582386612892151, 0.4979110360145569, 0.5386956334114075], [0.7423143982887268, 0.0024516191333532333, 0.8118932843208313, 0.06203959137201309], [0.449958860874176, 0.3092488646507263, 0.925218403339386, 0.7486948370933533], [0.6265607476234436, 0.8672387599945068, 0.7170670628547668, 0.9975826740264893], [0.7521734833717346, 0.5563433170318604, 0.8270179629325867, 0.6337069272994995], [0.7008721232414246, 0.5769227743148804, 0.9357900023460388, 0.7603199481964111], [0.6802763342857361, 0.00496804341673851, 0.7475579380989075, 0.05435599014163017], [0.3888310194015503, 0.5279465317726135, 0.5226026177406311, 0.5803504586219788], [0.7429617047309875, 0.8315353989601135, 0.8021603226661682, 0.9023458361625671], [0.8339731693267822, 0.00553525984287262, 0.8949185609817505, 0.16713924705982208], [0.8017362356185913, 0.819129228591919, 0.8378089666366577, 0.9002169370651245], [0.6768057942390442, 0.7708733081817627, 0.7212653756141663, 0.8653934001922607], [0.6969375610351562, 0.09311006963253021, 0.7395201921463013, 0.16517026722431183], [0.6262003779411316, 0.2200339138507843, 0.7188596129417419, 0.2810400426387787], [0.7427225708961487, 0.7637372612953186, 0.8147106766700745, 0.8677716851234436], [0.6616329550743103, 0.42618945240974426, 0.7870350480079651, 0.486371785402298], [0.904219388961792, 0.01280200108885765, 0.9461920261383057, 0.12902924418449402], [0.6760983467102051, 0.46838951110839844, 0.7913837432861328, 0.5324947834014893], [0.5761451721191406, 0.022273089736700058, 0.6289153099060059, 0.13466860353946686], [0.6981163620948792, 0.9674354195594788, 0.7606592774391174, 0.9904366135597229], [0.8479149341583252, 0.5795775651931763, 0.9110610485076904, 0.6531811952590942], [0.20231160521507263, 0.6926075220108032, 0.7333000898361206, 0.9602844715118408], [0.740067183971405, 0.16875074803829193, 0.7924347519874573, 0.2744978964328766], [0.571355402469635, 0.6158952713012695, 0.6396946310997009, 0.6695365905761719], [0.9186981320381165, 0.10866312682628632, 0.9418827891349792, 0.16070322692394257], [0.32595402002334595, 0.5540769100189209, 0.637843132019043, 0.7132388353347778], [0.5373077988624573, 0.19350823760032654, 0.9907111525535583, 0.8407703638076782], [0.6003190279006958, 0.8078675270080566, 0.7033053636550903, 0.9000135660171509], [0.32819992303848267, 0.20711709558963776, 0.7287113070487976, 0.35836517810821533], [0.7989151477813721, 0.7704529762268066, 0.8442840576171875, 0.8673362731933594], [0.8018954992294312, 0.2893969416618347, 0.8529118299484253, 0.3288710117340088], [0.7593734860420227, 0.005780167877674103, 0.8630147576332092, 0.21270427107810974], [0.38981303572654724, 0.11562787741422653, 0.741848349571228, 0.2614120543003082], [0.7359529733657837, 0.27608463168144226, 0.8009514808654785, 0.33048781752586365], [0.5679508447647095, 0.7191939949989319, 0.6662390232086182, 0.8098637461662292], [0.3718004822731018, 0.0026176422834396362, 0.864861786365509, 0.18622072041034698], [0.35479700565338135, 0.17170698940753937, 0.7312592267990112, 0.31840401887893677], [0.44913336634635925, 0.45123061537742615, 0.5629192590713501, 0.5550780296325684], [0.6807794570922852, 0.5672411322593689, 0.7422362565994263, 0.6248602271080017], [0.6079615354537964, 0.007678154855966568, 0.7091952562332153, 0.12389552593231201], [0.752412736415863, 0.7289851903915405, 0.797685444355011, 0.7905534505844116], [0.6382412910461426, 0.10518066585063934, 0.8411331176757812, 0.26172804832458496], [0.6661179065704346, 0.5245029330253601, 0.7850887775421143, 0.5920652747154236], [0.6255631446838379, 0.6769012212753296, 0.6999324560165405, 0.7686090469360352], [0.7815825939178467, 0.1745339334011078, 0.8321933746337891, 0.2780216932296753], [0.5754576921463013, 0.6661577820777893, 0.6486740112304688, 0.7546619772911072], [0.17603394389152527, 0.6910281777381897, 0.6853089332580566, 0.977545440196991], [0.1775466501712799, 0.0, 0.7935328483581543, 0.15366245806217194], [0.5626126527786255, 0.09370982646942139, 0.6246583461761475, 0.16489481925964355], [0.008244916796684265, 0.027631595730781555, 0.24718178808689117, 0.19646216928958893], [0.6904643177986145, 0.6075772643089294, 0.7490569949150085, 0.7313092350959778], [0.5992552638053894, 0.5759997367858887, 0.6944003701210022, 0.633960485458374], [0.37347158789634705, 0.3780865967273712, 0.5339198112487793, 0.6307519674301147], [0.6855097413063049, 0.3014838397502899, 0.7585253119468689, 0.39184537529945374], [0.723264217376709, 0.8621970415115356, 0.7898836135864258, 0.9958362579345703], [0.8279666304588318, 0.3105151653289795, 0.9135776162147522, 0.38425350189208984], [0.892098069190979, 0.0, 0.9678331613540649, 0.02787216752767563], [0.30649757385253906, 0.019994832575321198, 0.5943503975868225, 0.18714985251426697], [0.41911470890045166, 0.38405951857566833, 0.581757664680481, 0.6175873279571533], [0.17355510592460632, 0.8431512713432312, 0.7367626428604126, 0.9974773526191711]], "detection_scores": [0.9238758087158203, 0.5390700697898865, 0.48162055015563965, 0.4740534722805023, 0.44591692090034485, 0.3830966055393219, 0.3365892469882965, 0.2148517668247223, 0.19458799064159393, 0.19037902355194092, 0.18604367971420288, 0.1809423565864563, 0.17204299569129944, 0.16084779798984528, 0.1493222713470459, 0.14273308217525482, 0.13831423223018646, 0.1347302496433258, 0.13356998562812805, 0.13216784596443176, 0.12818829715251923, 0.12558236718177795, 0.1244615837931633, 0.12361863255500793, 0.12172367423772812, 0.12002003937959671, 0.11982611566781998, 0.11922907829284668, 0.11751743406057358, 0.11727286875247955, 0.11355448514223099, 0.11248594522476196, 0.11173310875892639, 0.10900630801916122, 0.10802798718214035, 0.10587064176797867, 0.10551241785287857, 0.10477710515260696, 0.1034858375787735, 0.1032470315694809, 0.10000587999820709, 0.09888678789138794, 0.09810101240873337, 0.097243532538414, 0.09710772335529327, 0.0967881977558136, 0.0966285839676857, 0.09624598175287247, 0.09545594453811646, 0.09345555305480957, 0.09306929260492325, 0.09149671345949173, 0.09062673151493073, 0.08946246653795242, 0.0894281417131424, 0.089266337454319, 0.08916683495044708, 0.08903171122074127, 0.08889546245336533, 0.0884314477443695, 0.08827470988035202, 0.08826471120119095, 0.08749204874038696, 0.08622260391712189, 0.08451997488737106, 0.08224860578775406, 0.08134584128856659, 0.08062338829040527, 0.08053841441869736, 0.08016771823167801, 0.07956513017416, 0.07879745215177536, 0.07864831387996674, 0.0785306990146637, 0.07645926624536514, 0.07608861476182938, 0.075721874833107, 0.07469195127487183, 0.07386594265699387, 0.0738387331366539, 0.07358201593160629, 0.07259880751371384, 0.07255819439888, 0.07224346697330475, 0.07178336381912231, 0.07168619334697723, 0.07105931639671326, 0.069760262966156, 0.06946500390768051, 0.06930697709321976, 0.06925581395626068, 0.06849288195371628, 0.06846559047698975, 0.0684201717376709, 0.0673224925994873, 0.06731405109167099, 0.06700354069471359, 0.06680446863174438, 0.0662548616528511, 0.06566256284713745], "detection_class_entities": ["Bicycle", "Person", "Wheel", "Wheel", "Bicycle wheel", "Bicycle wheel", "Man", "Footwear", "Footwear", "Clothing", "Footwear", "Footwear", "Footwear", "Footwear", "Man", "Clothing", "Footwear", "Footwear", "Person", "Footwear", "Footwear", "Footwear", "Clothing", "Footwear", "Footwear", "Footwear", "Tire", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Jeans", "Man", "Clothing", "Human arm", "Footwear", "Person", "Footwear", "Footwear", "Tire", "Footwear", "Human arm", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Footwear", "Man", "Footwear", "Footwear", "Footwear", "Clothing", "Bicycle", "Footwear", "Clothing", "Footwear", "Footwear", "Footwear", "Clothing", "Footwear", "Footwear", "Man", "Clothing", "Human arm", "Footwear", "Footwear", "Footwear", "Human leg", "Footwear", "Footwear", "Footwear", "Footwear", "Person", "Man", "Footwear", "Skyscraper", "Footwear", "Footwear", "Human arm", "Footwear", "Footwear", "Wheel", "Footwear", "Clothing", "Human arm", "Man"]}Wow, that was easy!