Skip to content

Instantly share code, notes, and snippets.

@ejones18
ejones18 / azureml_online_endpoint_streamlit.py
Created September 26, 2025 08:21
A Streamlit application for interacting with an AzureML Online Endpoint
import streamlit as st
import urllib.request
import json
import pandas as pd
from datetime import datetime, date
# Configure the page
st.set_page_config(
page_title="Page title",
layout="wide"
#!/usr/bin/env python
# coding: utf-8
# Ref: https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/samples/batch/python/python-client/main.py
import logging
import sys
import requests
import time
import swagger_client
@ejones18
ejones18 / real-time-diarization.py
Created December 8, 2023 10:12
Real time diarization using Azure Speech SDK
import time
import azure.cognitiveservices.speech as speechsdk
def conversation_transcriber_recognition_canceled_cb(evt: speechsdk.SessionEventArgs):
print('Canceled event')
def conversation_transcriber_session_stopped_cb(evt: speechsdk.SessionEventArgs):
print('SessionStopped event')
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-o', '--output', default='output.txt', help='The name of the output file')
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--files', nargs='+', help='The names of the files to process')
parser = argparse.ArgumentParser()
parser.add_argument('filename', help='The name of the file to process')
@ejones18
ejones18 / mc_dropout_example.py
Last active February 11, 2023 13:39
A simple example showing the implementation of MC-Dropout
import keras
# Define a model with dropout layers
model = keras.models.Sequential()
model.add(keras.layers.Dropout(0.02))
model.add(keras.layers.Dense(64, activation='relu'))
model.add(keras.layers.Dropout(0.5))
model.add(keras.layers.Dense(64, activation='relu'))
model.add(keras.layers.Dense(10, activation='softmax'))
@ejones18
ejones18 / pykale_example.py
Created October 11, 2022 09:44
A quick example using the Pykale library - SVC model on the MNIST dataset
from genericpath import exists
import os
import torch
from kale.loaddata import mnistm as mn
from kale.loaddata.dataset_access import split_by_ratios
from kale.utils.print import pprint_without_newline, pprint
from kale.pipeline import mpca_trainer as mpca_train
from PIL import Image, ImageFilter
@ejones18
ejones18 / pdb_example.py
Last active September 11, 2022 08:17
An example of The Python Debugger module
def addition(x: int, y: int):
"""
Add two numbers together.
Parameters
----------
`x` : int
First number to be part of the operation.
`y` : int
Second number to be part of the operation.
@ejones18
ejones18 / chart.js
Created August 15, 2022 14:29
Snippet from an auto-updating Flask application that uses OpenWeatherMap API for real-time data
var data_ = []
var chart = null;
$( document ).ready(function() {
refresh_weather_data()
setInterval(function() { refresh_weather_data() }, 300000);
});
function refresh_weather_data() {
$.ajax({