Skip to content

Instantly share code, notes, and snippets.

@jalakoo
jalakoo / app.py
Created April 15, 2025 04:00
Super Simple RushDB Python Sample App
from rushdb import RushDB
# Initialize the RushDB client
client = RushDB(
"<your_locally_generated_api_key>",
base_url="http://localhost:3000",
)
# Simple - Create a single Node
single_record = {
@jalakoo
jalakoo / app.py
Created April 18, 2025 18:15
Python code for extracting entities from audio with AssemblyAI, then uploading that data into a Neo4j Graph database
import assemblyai as aai
from neo4j import GraphDatabase
aai.settings.api_key = "<ASSEMBLYAI_API_KEY>"
audio_file = "https://assembly.ai/wildfires.mp3"
# audio_file = "./local_file.mp3" #syntax for using a local file
config = aai.TranscriptionConfig(entity_detection=True)
transcript = aai.Transcriber().transcribe(audio_file, config)
@jalakoo
jalakoo / main.py
Created April 19, 2025 03:31
Simple FastAPI server that takes a list of URLs for audio files, extract entities using AssemblyAI and uploads it to Neo4j.
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import assemblyai as aai
from neo4j import GraphDatabase
from dotenv import load_dotenv
import os
# Load environment variables
load_dotenv()
@jalakoo
jalakoo / main.py
Created April 20, 2025 00:29
Simple Python script for updating all Nodes "name" property in a target Neo4j database
from neo4j import GraphDatabase
import sys
def update_node_names(uri, user, password, target, replace_with):
driver = GraphDatabase.driver(uri, auth=(user, password))
def update_name(tx, target, replace_with):
query = (
"MATCH (n) "
"WHERE n.name = $target "
@jalakoo
jalakoo / app.py
Created May 13, 2025 03:30
BAML to Graph Data Example
import streamlit as st
from st_cytoscape import cytoscape
from baml_client import b
import json
# Set page config
st.set_page_config(layout="wide")
def process_graph_result(result):
"""Convert BAML graph result to cytoscape elements format"""