Skip to content

Instantly share code, notes, and snippets.

@javaj0hn
javaj0hn / test.py
Last active September 26, 2025 15:53
# requirements.txt
fastapi==0.104.1
uvicorn[standard]==0.24.0
pydantic==2.5.0
pydantic-settings==2.1.0
httpx==0.25.2
chromadb==0.4.18
python-multipart==0.0.6
aiofiles==23.2.1
tenacity==8.2.3
<script>
import {
FileText, Zap, Eye, RefreshCw, Copy, Check,
ChevronDown, ChevronRight, BookOpen, HelpCircle,
List, Info
} from 'lucide-svelte';
let selectedArticleId = null;
let selectedSections = new Set();
let rewrittenSections = {};
#!/usr/bin/env python3
"""
Intent Detection Script
Loads a joblib model file and processes text input to detect intent with confidence and timing.
"""
import joblib
import time
import argparse
import sys
# quick_test.py - Direct model testing (no server needed)
from intent_classifier import FastIntentClassifier
def quick_test():
"""Quick test of the model without FastAPI"""
print("🚀 Training model...")
classifier = FastIntentClassifier(confidence_threshold=0.6)
classifier.train() # Uses sample data
print("✅ Model trained! Testing predictions...\n")
import pandas as pd
import numpy as np
import pickle
import re
import time
from typing import List, Tuple, Dict, Optional
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.metrics import classification_report, confusion_matrix
# quick_test_enhanced.py - Multi-speaker model testing (no server needed)
from intent_classifier import EnhancedIntentClassifier
import time
def quick_test(model_path: str = None):
"""Quick test of the enhanced multi-speaker model from joblib file"""
if model_path:
print(f"📂 Loading enhanced multi-speaker model from {model_path}...")
classifier = EnhancedIntentClassifier(confidence_threshold=0.6)
try:
#!/usr/bin/env python3
“””
Intent Manager - High-level interface for conversation intent detection.
Combines semantic search with conversation tracking and speaker context.
“””
import json
import time
import logging
from typing import List, Dict, Optional, Tuple, Union
#!/usr/bin/env python3
"""
Semantic search for conversation intents and topics.
Matches conversation snippets against predefined intents using sentence embeddings.
"""
import json
import numpy as np
from typing import List, Dict, Tuple, Optional, Set
from dataclasses import dataclass, field
@javaj0hn
javaj0hn / run.py
Created February 15, 2018 17:35
Complete Discord Bot run file
#!/usr/bin/env python3
# import dependencies
import os
from discord.ext import commands
import discord
import datetime, re
import json, asyncio
import copy
import configparser
#coding: utf-8
from bottle import route, error, post, get, run, static_file, abort, redirect, response, request, template
@route('/')
@route('/index.html')
def index():
return '<a href="/hello">Go to Hello World page</a>'
@route('/hello')
def hello():