Skip to content

files() method on dataDirectory class returns empty directoryEntries list #11

@marton-balazs-kovacs

Description

@marton-balazs-kovacs

Hi!

Great package! I tried to play around and use the deeplearning/ColorfulImageColorization/1.1.13 algorithm to colorizeblack and white images.

I uploaded the images in a new collection that I created on Algorithmia. I could access the collection directory with nlp_directory <- client$dir(path) and I could ask for a file by name in that directory with nlp_directory$file("test.jpg"). Or at least that is what I assume after the exists() method returned TRUE.

However, input_files <- nlp_directory$files() and then input_files$directoryEntries returned an empty list.

Maybe I am just missing something, I tried to find any explanation in the docs but with no luck.

p.s. I could get the filenames from my local dir at the end and I could use those in the algo call and it worked like a charm.

Thank you for your help!

Here is my full code:

install.packages("algorithmia")
library(algorithmia)
# Authenticate with your API key
apiKey <- "MY_API"
# Create the Algorithmia Client object
client <- getAlgorithmiaClient(apiKey)

# Get (and create) a directory collection
path <- "data://marton_balazs_kovacs/test"
nlp_directory <- client$dir(path)
nlp_directory$create()

# Update directory permissions (e.g. make it private)
nlp_directory$updatePermissions(ReadAcl.PRIVATE)
nlp_directory$getPermissions()$read_acl

# Get one file
## If you refer to the file with the exact name the function works
input <- nlp_directory$file("test.jpg")
## Test if the file that we asked for exists
input$exists()

# Get childs of the directory collection
## This function supposed to get all the files in my directory but it does not
input_files <- nlp_directory$files()
## This argument should get the names of the files in a list but it does not work
input_files <- input_files$directoryEntries

# Get the names of the files from a local repository
## Path to the local directory with the images
local_path <- file.path("MY_PATH")
## Get the filenames in that repository
local_filenames <- list.files(local_path)
## Append filenames to the dirpath on algorithmia and store it in a list obj
input_files <- list(image = paste(path, local_filenames, sep = "/"))

# Run the algorithm
algo <- client$algo("deeplearning/ColorfulImageColorization/1.1.13")
algo$setOptions(timeout=300) # optional
result <- algo$pipe(input_files)$result
print(result)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions