This file contains 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 fakeredis | |
import json | |
server = fakeredis.FakeServer() | |
redis = fakeredis.FakeStrictRedis(server=server) | |
print(redis) | |
# try fetching a record | |
userID = 12345 | |
record = redis.get(userID) |
This file contains 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 pandas as pd | |
df = pd.read_csv("game_skater_stats.csv") | |
df = df[df['player_id'] == 8467412] | |
print(df.head(3)) | |
for index, row in df.iterrows(): | |
event = { "playerID": int(row['player_id']), "Game_ID": int(row['game_id']), | |
"goals": int(row['goals']), "assists": int(row['assists']), | |
"shots": int(row['shots']), "hits": int(row['hits']) } |
This file contains 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 flask | |
import fakeredis | |
import json | |
server = fakeredis.FakeServer() | |
redis = fakeredis.FakeStrictRedis(server=server) | |
app = flask.Flask(__name__) | |
# endpoint for profile updates | |
@app.route("/update", methods=["GET","POST"]) |
This file contains 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 dash | |
from flask import Flask | |
from flask_dance.contrib.google import google as flask_google | |
from datetime import datetime | |
import dash_html_components as html | |
from dash_google_auth import GoogleOAuth | |
server = Flask(__name__) | |
server.config["GOOGLE_OAUTH_CLIENT_ID"] = 'YOUR_CLIENT_ID' |
This file contains 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
from flask import Flask | |
from flask_httpauth import HTTPTokenAuth | |
app = Flask(__name__) | |
auth = HTTPTokenAuth(scheme='Token') | |
@auth.verify_token | |
def verify_token(token): | |
return '1234567890abcdefg' == token |
This file contains 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 requests | |
headers = { 'Authorization' : 'Token 1234567890abcdefg' } | |
result = requests.post("http://localhost:8000", headers=headers, \ | |
json = { 'G1':'1', 'G2':'0', 'G3':'0', 'G4':'0', 'G5':'0', \ | |
'G6':'0', 'G7':'0', 'G8':'0', 'G9':'0', 'G10':'0'}) | |
print(result) | |
print(result.text) |
This file contains 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 requests | |
result = requests.post("http://localhost", \ | |
json = { 'G1':'1', 'G2':'0', 'G3':'0', 'G4':'0', 'G5':'0', \ | |
'G6':'0', 'G7':'0', 'G8':'0', 'G9':'0', 'G10':'0'}) | |
print(result) | |
print(result.json()) |
This file contains 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 pandas as pd | |
from sklearn.linear_model import LogisticRegression | |
import flask | |
df = pd.read_csv("https://github.com/bgweber/Twitch/raw/master/Recommendations/games-expand.csv") | |
model = LogisticRegression() | |
model.fit(df.drop(['label'], axis=1), df['label']) | |
app = flask.Flask(__name__) |
This file contains 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
from google.cloud import monitoring_v3 | |
from google.oauth2 import service_account | |
from google.cloud import logging | |
import socket | |
import random | |
import time | |
import pandas as pd | |
from sklearn.linear_model import LogisticRegression | |
import flask | |
from multiprocessing import Value |
This file contains 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
cat serving.json | sudo docker login -u _json_key --password-stdin https://us.gcr.io | |
sudo docker tag model_service us.gcr.io/serving-268422/model_service | |
sudo docker push us.gcr.io/serving-268422/model_service |
NewerOlder