This file contains hidden or 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
var imageUUIDs: ListBuffer[String] = new ListBuffer[String] | |
var pixvanaOperationRequests: ListBuffer[FutureAlgoResponse] = new ListBuffer[FutureAlgoResponse] | |
//async data transfer masking | |
imageSplitRequests.foreach((response: FutureAlgoResponse) =>{ | |
val imageUUID = response.get().toString | |
imageUUIDs += imageUUID | |
val imageCombine = Supernova(imageUUID, script) | |
This file contains hidden or 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
//async data transfer masking | |
val processingOperationRequests: List[FutureAlgoResponse] = imageSplitRequests.map((response: FutureAlgoResponse) =>{ | |
val imageUUID = response.get.toString | |
val imageCombine = Supernova(imageUUID, script) | |
client.algo("algo://supernovaTest/Supernova/0.1.25").pipeAsync(imageCombine) | |
}) | |
val recombineChunkRequests: List[FutureAlgoResponse] = pixvanaOperationRequests.map((response: FutureAlgoResponse) => { | |
val pixvanaUUID = response.get.toString | |
val imageCombine = CombineImages(pixvanaUUID, "temp", "temp", "recombinedChunks", "mkv", 15) |
This file contains hidden or 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
case class ClassInput[I,O](name: String, classObj: Class[I], func: I => O) | |
def patternMatchCaseClasses(classes: List[ClassInput], gsonInput: JsonElement): Any = {} |
This file contains hidden or 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
val url: URL = new URL("http://www.reddit.com/r/pics/new.json?sort=new") | |
val conn: URLConnection = url.openConnection() | |
conn.setRequestProperty("User-Agent", "scala:com.algorithmia.redditImageScraper:v1.0.0 (by /u/zeryx)") | |
conn.connect() | |
val response: BufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream)) | |
val input:Json = Json.parse(response.readLine()) | |
response.close() |
This file contains hidden or 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
{"csv_1":"...", "csv_2":"..."} | |
you can make a python .startswith() if check to detect if the string contains an http://, https://, data://, etc. |
This file contains hidden or 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
import Algorithmia | |
client = Algorithmia.client(INSERT_ALGORITHMIA_API_KEY_HERE) | |
input = {} | |
input["input"] = "data://util/Temp/dogs_and_cats.csv" | |
input["output"] = "dogs_and_cats.pdf" | |
input["collection"] = "data://.my/Temp" | |
result = client.algo("algo://util/FileConverter/0.2.0").pipe(input) | |
pdfFile = client.file(str(result.result)).getFile() | |
#via REPL |
This file contains hidden or 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
import Algorithmia | |
def apply(input): | |
if isinstance(input, dict): | |
... do stuff ... | |
out = {} | |
out["firstCsv"] = "data://path/to/csv1.csv" | |
out["secondCsv"] = "data://path/to/csv2.csv" | |
return out |
This file contains hidden or 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
#lets assume you have an algorithm that returns two key/value stores, csv1 and csv2. | |
import Algorithmia | |
import json | |
import csv | |
#payload class to deserialize json | |
class Payload(object): | |
def __init__(self, j): | |
self.__dict__ = json.loads(j) | |
client = Algorithmia.client(YOUR_ALGORITHMIA_KEY_HERE) | |
input = {} |
This file contains hidden or 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
app.controller('labellingSwipe', ['$scope', '$location', '$rootScope', 'usedDefs', 'tags', 'hammerjs', function ($scope, $location, $rootScope, usedDefs, tags, hammer) { | |
$scope.tagDefs = JSON.parse(document.getElementById("tagDefs").value); | |
$scope.imageUrl = document.getElementById("image-url").value; | |
$scope.tagDef = getNext($scope.tagDefs, usedDefs); | |
if($scope.tagDef === null){ | |
$scope.lastDefs = diffArray(tagDefs, usedDefs); | |
} | |
This file contains hidden or 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
package models | |
import java.security.MessageDigest | |
import play.api.libs.json._ | |
case class User(username: String, password: String) | |
object User { |