My telegram bot is designed to do image classification so I need to first read in the image from the user, for example, by using cv2.imread(telegram_image.jpeg, 1)
before doing any processing and running my model on it. Is there a way to do this without having to download the image file from the telegram bot?
This is the code I have so far:
bot = telegram.Bot(token=TOKEN)
@app.route('/{}'.format(TOKEN), methods=['POST'])
def start():
# retrieve the message in JSON and then transform it to Telegram object
update = telegram.Update.de_json(request.get_json(force=True), bot)
chat_id = update.message.chat.id
msg_id = update.message.message_id
imageId = update.message.photo[len(update.message.photo)-1].file_id
I am trying to deploy on Heroku (using Flask), but was having issues previously trying to download the files using update.message.photo[-1].get_file().download()
. The code ran without errors but I couldn't find the image file anywhere.
Sorry I am quite new to this, would really appreciate any help or suggestions, thank you!