Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save besirkurtulmus/d2297475e96733f8b641f4abc4bfc8c7 to your computer and use it in GitHub Desktop.
Save besirkurtulmus/d2297475e96733f8b641f4abc4bfc8c7 to your computer and use it in GitHub Desktop.
How to get direct links to images on Algorithmia
import Algorithmia
client = Algorithmia.client("YOUR_API_KEY_GOES_HERE")
# this is an example image dataURL you get from: https://algorithmia.com/algorithms/deeplearning/DeepFilter
imageDataUrl = "data://.algo/deeplearning/DeepFilter/temp/filtered_image.jpg"
# this is the file handler for the image
fileHandler = client.file(imageDataUrl).getFile()
# this is the absolute file location for the image eg: /tmp/adsAD13b
print fileHandler.name
# you can upload the file to your image host to get a direct link
# Note: upload function here refers to whatever image hosting provider you use
uploadFunction(fileHandler.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment