Skip to content

Instantly share code, notes, and snippets.

Alan Nichol amn41

Block or report user

Report or block amn41

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 app.py
import streamlit as st
import numpy as np
import pandas as pd
import json
import requests
@st.cache
def get_auth_token(host, user, pw):
st.write("cache miss token!")
url = f"{host}/api/auth"
View carbon_bot_conversion.py
import json
import requests
def get_auth_token(host, user, pw):
url = f"{host}/api/auth"
payload = {"username": user, "password": pw}
response = requests.post(url, json=payload)
try:
token = response.json()["access_token"]
return token
@amn41
amn41 / README.md
Last active Apr 15, 2020
Github Actions Workflow to comment on a Rasa repo PR with cross-validation results
View README.md

Comment on a GitHub PR with Rasa NLU cross-validation results

image

Instructions

Save the yaml file at .github/workflows/comment_crossval_results.yml

Add the format_results.py script at the root of your repo.

View custom_http.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from flask import Blueprint, request, jsonify
import requests
from rasa_dm.channels.channel import UserMessage, OutputChannel
View http_action.py
from rasa_dm.actions import Action
import requests
class ActionHTTPRequest(Action):
def name(self):
return "make_request"
def run(self, dispatcher, tracker, domain):
url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json'
result = requests.get(url).json()
@amn41
amn41 / process_logs.py
Created Jul 31, 2017
read rasa nlu logs, optionally reprocess, and dump to file
View process_logs.py
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import str as text
import argparse
import io
import json
View sample_lstm.py
"""Implements the long-short term memory character model.
This version vectorizes over multiple examples, but each string
has a fixed length."""
from __future__ import absolute_import
from __future__ import print_function
from builtins import range
from os.path import dirname, join
import numpy as np
import numpy.random as npr
View rino_persist.py
import rinocloud as rino
import shutil, os
import subprocess
import hashlib
"""
persist = Persistor(config.rino_token,config.rino_dir)
def save_model_new(persist,model_file,score):
temp_file="tmp_{0:06d}.txt".format(random.choice(range(10000)))
View coupledGPs.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View nn_classify_text.py
import numpy as np
def sum_vecs(embed,text):
tokens = text.split(' ')
vec = np.zeros(embed.W.shape[1])
for idx, term in enumerate(tokens):
if term in embed.vocab:
vec = vec + embed.W[embed.vocab[term], :]
You can’t perform that action at this time.