Skip to content

Instantly share code, notes, and snippets.

View SaschaHeyer's full-sized avatar
👨‍🚀

Sascha Heyer SaschaHeyer

👨‍🚀
View GitHub Profile
@SaschaHeyer
SaschaHeyer / Dockerfile
Created July 1, 2020 16:47 — forked from Irio/Dockerfile
GCP Serverless scrapers
FROM golang:1.12 as build
WORKDIR $GOPATH/src/github.com/Irio/wohnung
COPY scraper scraper
COPY main.go .
RUN go get -d -v ./...
RUN go install
FROM gcr.io/distroless/base
@SaschaHeyer
SaschaHeyer / export.py
Created July 27, 2020 19:14
export.py
URL = "https://api.ioannotator.com/api/export"
# parameter
apikey = "PZK888A-AEQMDPY-MKKPU2Q-JZ786NX"
dataset = "5758665286207488"
# defining a params dict for the parameters to be sent to the IO Annotator API
PARAMS = {'apikey':apikey, 'dataset': dataset}
# sending get request and saving the response (annotations) as response object
r = requests.get(url = URL, params = PARAMS)
# extracting data in json format
data = r.json()
@SaschaHeyer
SaschaHeyer / setup.js
Created October 5, 2020 15:21
Simple API Management Setup
// install the package
// npm install simple-api-management-nodejs
const simpleAPIManagement = require('simple-api-management-nodejs');
app.use(simpleAPIManagement(
{
apiKey: 'add your API key',
}
));
@SaschaHeyer
SaschaHeyer / TensorFlow Serving
Last active January 2, 2021 15:52
TensorFlow Serving
docker pull tensorflow/serving
docker run -p 8501:8501 \
--mount type=bind,source=/path/to/my_model/,target=/models/my_model \
-e MODEL_NAME=my_model -t tensorflow/serving
@SaschaHeyer
SaschaHeyer / component.py
Last active August 26, 2021 18:26
vertex ai component
@component()
def concat(a: str, b: str) -> str:
return a + b
@component
def reverse(a: str)->NamedTuple("outputs", [("before", str), ("after", str)]):
return a, a[::-1]
@SaschaHeyer
SaschaHeyer / requirements.py
Last active August 24, 2021 12:02
Vertex AI Pipelines requirements
import kfp
from kfp.v2.dsl import pipeline
from kfp.v2.dsl import component
from kfp.v2 import compiler
@SaschaHeyer
SaschaHeyer / specification.py
Created August 17, 2021 13:36
Vertex AI Pipelines component decorator component specification
@component(output_component_file="component.yaml")
@SaschaHeyer
SaschaHeyer / pipeline.py
Last active August 26, 2021 18:31
Vertex AI Pipeline
@pipeline(name="basic-pipeline",
description="A basic pipeline with function based components",
pipeline_root='gs://doit-vertex-ai-demo/basic-pipeine')
def basic_pipeline(a: str='stres', b: str='sed'):
concat_task = concat(a, b)
reverse_task = reverse(concat_task.output)
@SaschaHeyer
SaschaHeyer / compiler.py
Last active August 26, 2021 18:31
Vertex AI Pipeline Compiler
compiler.Compiler().compile(
pipeline_func=basic_pipeline,
package_path="basic_pipeline.json"
)
@SaschaHeyer
SaschaHeyer / lilmits.py
Last active August 26, 2021 18:41
Vertex AI Pipelines - ressource
set_cpu_limit('CPU_LIMIT')
set_memory_limit('MEMORY_LIMIT')