Skip to content

Instantly share code, notes, and snippets.

@carlthome
carlthome / audioldm-stable-audio-open-musicgen.ipynb
Created September 9, 2024 08:09
AudioLDM, Stable Audio Open, MusicGen.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@waf
waf / Program.cs
Last active July 21, 2024 13:30
Complete program that plays MineSweeper in the terminal in 100 non-whitespace lines of code. Ported from https://radanskoric.com/experiments/minesweeper-100-lines-of-clean-ruby
if (args.Length == 3)
{
Play(args.Select(int.Parse).ToArray());
}
else
{
Console.WriteLine("Usage: Minesweeper width height mineCount (e.g. Minesweeper 12 6 6)");
}
static void Play(params int[] args)
@adlumal
adlumal / goalchain_example.py
Last active May 26, 2024 09:07
GoalChain example
from goalchain import Field, ValidationError, Goal, GoalChain
import os
os.environ["OPENAI_API_KEY"] = "sk-ABC..." # SPECIFY OPENAI API KEY
def quantity_validator(value):
try:
value = int(value)
except (ValueError, TypeError):
raise ValidationError("Quantity must be a valid number")
@Cortexelus
Cortexelus / udio.py
Last active November 20, 2024 02:03
Automate Udio (2024-04-13)
# AUTOMATE UDIO
# by DADABOTS dadabots.com
# was working on 2024-04-13
# tldr; get your login cookie, use it to automate udio from python
import requests
import json
from time import sleep
import re
@ivanfioravanti
ivanfioravanti / gist:bcacc48ef68b02e9b7a4034161824287
Created January 25, 2024 00:01
Fine tuning dataset generation wiht Ollama python library
import json
import os
import ollama
def query_ollama(prompt, model='openhermes:7b-mistral-v2.5-q6_K', context=''):
response = ollama.generate(
model=model,
prompt=context + prompt)
return response['response'].strip()
@0xc1c4da
0xc1c4da / lmql_babyagi.py
Created August 19, 2023 11:27
Basic BabyAGI Implementation in LMQL
import lmql
from dataclasses import dataclass
from typing import List
# Data Structures
@dataclass
class Task:
task: str
# result: str
@zz2115
zz2115 / main.py
Created August 8, 2023 23:10
QA Chatbot streaming with source documents example using FastAPI, LangChain Expression Language, OpenAI, and Chroma.
"""QA Chatbot streaming using FastAPI, LangChain Expression Language , OpenAI, and Chroma.
Features
--------
- Persistent Chat Memory:
Stores chat history in a local file.
- Persistent Vector Store:
Stores document embeddings in a local vector store.
- Standalone Question Generation:
Rephrases follow-up questions to standalone questions in their original language.
@JustMaier
JustMaier / example.md
Created August 4, 2023 15:58
ChatGPT contextual conversation starter prompt

You are an AI Prompt engineer at OpenAI and you have just found the best prompt for effectively starting conversations with ChatGPT, an AI language model and assistant. Write an effective beggining prompt that can be used to start a conversation with ChatGPT. The prompt should:

  1. start with a persona
  2. provide relevant context for that persona to be performing the requested function
  3. Briefly outline the task they've been requested to perform
  4. Request they follow a given format
  5. Describe the tone they should use
  6. Provide them a brief example of what you're looking for Use clear and concise language and write in a confident yet friendly tone. Use this request as an example:

"You are a senior product marketing manager at Apple and you just launched the latest Apple product, the Apple Car, and received 12,000 pre-orders, which is 200% higher than target. Write an email to your boss, Tim Cooke, sharing this positive news. The email should follow the exact same format as the one I will share below. Use c

import os
import openai
import time
os.environ["OPENAI_API_KEY"] = <your API key>
openai.api_key = os.getenv("OPENAI_API_KEY")
# Starting templates
INQUIRY_PERSONA_starting_template = """
Act as a {INQUIRY_PERSONA}. I {TASK}.

AI-Powered Algorithmic Trading with Python

ODSC London 2023 Half-Day Training

Dr. Yves J. Hilpisch
CEO The Python Quants | The AI Machine
Adjunct Professor of Computational Finance