This file contains hidden or 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
""" | |
So, you can give instruction to structured output (SO) in 3 format: | |
1. Include in desciription in the field of SO | |
2. Include the JSON schema in prompt. | |
3. Include it directly in prompt in Natural langauge | |
If we are given conflicting instructions between prompt and structured output, | |
which one will win? This will tell which of the above is the most powerful! | |
It turns out that: |
This file contains hidden or 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
/** Label Studio include for MathJax. | |
* | |
* https://docs.humansignal.com/guide/scripts | |
* | |
* Script src: https://gist.github.com/dat-boris/cc36f2f92fb29d7cb0b00dcabf2d89b6 | |
*/ | |
LSI.import('https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'); | |
function initMathJax() { |
This file contains hidden or 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
# Example URL: https://ai-useast2hub770089131882.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview | |
# - Note the `services.ai.azure.com` domain name, which use `api-key` for auth | |
# - instead of the `models.ai.azure.com` - which will use `Token bearer` | |
curl -X POST "${AZURE_SERVICE_URL}" \ | |
-H "Content-Type: application/json" \ | |
-H "api-key: ${AZURE_SERVICE_KEY}" \ | |
-d '{ | |
"messages": [ | |
{ | |
"role": "user", |
This file contains hidden or 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 cv2 | |
import numpy as np | |
# Define 3D object points | |
object_points = np.array([ | |
[0, 0, 0], | |
[1, 0, 0], | |
[1, 1, 0], | |
[0, 1, 0] | |
], dtype=np.float32) |
This file contains hidden or 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
#!/usr/bin/env python3 | |
"""A simple script to capture screen, that then post to the server as websocket | |
for setting up the messages. | |
We log these folders to allow for the case for following through the data. The | |
folder structure works with: | |
- logs/video/<yyyymmdd-hhmmss>.avi | |
- logs/keyframes/<yyyymmdd-hhmmss>_<frame>.png |
This file contains hidden or 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
#!/usr/bin/env python | |
"""A script for downloading video from https://publicorderemergencycommission.ca | |
Oh my, the site is awful! It streams the mp4 in .ts format that is much slower | |
than the stream reate. So this script downloads the stream and compress it using | |
ffmpeg h264 codec. | |
You will need to find the video link - you can do that by using the developer tool | |
when playing the video on page |
This file contains hidden or 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
#!/usr/bin/env python | |
"""Ensure that you write out loud when you write your text. | |
brew install portaudio | |
pip installl pynput speechrecognition pyaudio pyttsx3 | |
./out_loud.py | |
WARNING: you might need to hack your security setting following: | |
https://stackoverflow.com/questions/53088995/pynput-keyboard-listener-does-not-detect-keys-on-mac-os-x | |
""" |
This file contains hidden or 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
"""PettingZoo | |
Tutorial from: https://nbviewer.org/github/gsverhoeven/gt_rl_course/blob/master/week_8/marl_tictactoe.ipynb | |
Setup: | |
pipenv install pettingzoo[classic] | |
""" | |
import random |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"os" | |
"net" | |
"log" | |
"time" | |
) | |
func main() { | |
port := os.Args[1] |
This file contains hidden or 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 re | |
import tempfile | |
import google.cloud.storage as storage | |
def analyse_one_logfile(gcs_full_path): | |
client = storage.Client() | |
bucket = client.get_bucket(DEV_LOGFILE_BUCKET_NAME) | |
m = re.match('gs://{}/(.*)'.format(DEV_LOGFILE_BUCKET_NAME), gcs_full_path) |
NewerOlder