Last active
October 21, 2019 18:00
-
-
Save EsteveSegura/7e28f3fe4ed74372b8d69ef66eb3415a to your computer and use it in GitHub Desktop.
instagram vot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const download = require('image-downloader') | |
const detectFood = require('./detectFood'); | |
//download instagram post | |
async function downloadPost(ig,media_id){ | |
try { | |
let postToDownload = await getMediaIdInfo(ig,media_id); | |
let downloadedData = await downloadImageFromUrl(postToDownload.items[0].image_versions2.candidates[0].url,media_id); | |
return downloadedData; | |
} catch (error) { | |
return 'cant_read'; | |
} | |
} | |
//use package image-downloader for downloading images from the internet | |
async function downloadImageFromUrl (url,id){ | |
const path = `./imgs/${id}.jpg`; | |
await download.image({url: url,dest: path}); | |
return id; | |
} | |
//this way can call python vggModel.py | |
async function getPrediction(path){ | |
let pred = await detectFood.getPrediction(path); | |
return pred; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment