Skip to content

Instantly share code, notes, and snippets.

Tony Hung tbass134

  • New York
Block or report user

Report or block tbass134

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:599031e6525473e2f02fd66a174fb3ec
let input = coffee_predictionInput(input: mlMultiArray)
guard let prediction = try? model.prediction(input: input) else {
return
}
let result = prediction
print("classLabel \(result.classLabel)")
if result.classLabel == 1 {
self.class_image.image = UIImage.init(named: "coffee_hot")
View one-hot.swift
func toOneHot(_ string:String) -> [Double] {
var str = string
var items = [Double](repeating: 0.0, count: 7)
let weather_conds:[String] = ["Clear", "Clouds", "Fog", "Haze", "Rain", "Smoke", "Snow"]
if str.lowercased().range(of:"cloud") != nil || str.lowercased().range(of:"overcast") != nil{
str = "Clouds"
}
if str.lowercased().range(of:"snow") != nil {
@tbass134
tbass134 / getInfo.js
Last active May 25, 2019
Dialogflow webhook to transfer user to live agent
View getInfo.js
function getInfo(contexts) {
var product = contexts[contexts.length - 1]['parameters']['Product']
var state = contexts[contexts.length - 1]['parameters']['geo-state-us']
for (var i = 0; i < contexts.length; i++) {
var context = contexts[i]['parameters']
if (typeof context['Product'] != "undefined" && typeof context['geo-state-us'] != "undefined") {
return context
}
@tbass134
tbass134 / download.py
Last active Sep 8, 2018
Download Transcriptions from Youtube playlist
View download.py
import requests
import json
import pandas as pd
from pandas.io.json import json_normalize #package for flattening json in pandas df
from xml.etree import ElementTree
from pandas.io.json import json_normalize
import sys
YT_API_KEY = '{youtube_api_key}'
playlist_id = '{playlist_id}'
View Dog-Breed-Dectector_Server.py
import sys
import os
import shutil
import time
import traceback
import requests
import numpy as np
from flask import Flask, request, jsonify
You can’t perform that action at this time.