Skip to content

Instantly share code, notes, and snippets.

View jcollingj's full-sized avatar

Jake Colling jcollingj

View GitHub Profile
@jcollingj
jcollingj / fastapi_mlx.py
Created May 17, 2024 13:17
fastapi-mlx
import json
from mlx_lm.utils import load, generate_step
import mlx.core as mx
from fastapi import FastAPI, HTTPException, Depends, Request
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
from mlx_lm import load, generate
import asyncio
from typing import List
from starlette.responses import StreamingResponse # Add this import
@jcollingj
jcollingj / superwhisper_stats.ts
Created March 28, 2024 14:19
Get your stats out of Superwhisper
import { readdirSync, readFileSync } from "fs";
import { join } from "path";
function listContentsAndAnalyzeDurations(directoryPath: string) {
const filesAndFolders = readdirSync(directoryPath, { withFileTypes: true });
let totalRecordings = 0;
let durations_milliseconds: number[] = [];
let totalCharacters = 0;
let totalWords = 0;