Skip to content

Instantly share code, notes, and snippets.

View aayusharora's full-sized avatar
🎯
Writing my next Codelab

Aayush Arora (angularboy) aayusharora

🎯
Writing my next Codelab
View GitHub Profile
var session = require('express-session');
. . .
var RedisStore = require('connect-redis')(session);
var redisClient = require('redis').createClient(process.env.REDIS_URL);
var redisOptions = {
client: redisClient,
import base64
import io
import json
import requests
def container_predict(image_file_path, image_key, port_number=8501):
with io.open(image_file_path, 'rb') as image_file:
encoded_image = base64.b64encode(image_file.read()).decode('utf-8')
import base64
import io
import json
import requests
def container_predict(image_file_path, image_key, port_number=8501):
"""Sends a prediction request to TFServing docker container REST API.

README

Deployment

gcloud functions deploy 'on_csv_upload' --runtime python37 --project 'remarketer' --trigger-resource 'homebuckettest' --trigger-event google.storage.object.finalize --service-account aayush@remarketer.iam.gserviceaccount.com

#Setting Up From the GA 360 Dashboard, provide admin access to the following email : aayush@remarketer.iam.gserviceaccount.com

import { TOKEN1, TOKEN2, TOKEN3 } from './token';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
import { TOKEN1 } from './token';
import { Injectable, Inject } from '@angular/core';
@Injectable()
export class MainService {
constructor(@Inject(TOKEN1) private api: string) {
console.log(this.api);
}
import { Injectable, Inject } from '@angular/core';
@Injectable()
export class MainService {
constructor(@Inject('api') private api: string) {
console.log(this.api);
}
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [
{provide: 'api', useValue: 'api/v5/dialogflow'}
import { ConverterPipe } from './converter.pipe';
import { Component } from '@angular/core';
import {Rates} from './rates';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: [ConverterPipe]
})
export class AppComponent {
transform(value: any, args?: any): any {
// Get rates Object from rates.ts
this.rates = new Rates().rates;
// Get all the keys i.e the currency names
this.rateArray = Object.keys(this.rates);
// Search the index of the selected currency name in array
this.index = this.rateArray.indexOf(args);
// Get the value of the selected currency i.e rate of selected currency from the object
this.selected = this.rates[Object.keys(this.rates)[this.index]];