Skip to content

Instantly share code, notes, and snippets.

@Somberor
Somberor / nsfw_server_runpod.sh
Last active January 28, 2026 00:43
NSFW Detection Server (OpenNSFW2) - One-liner deploy for RunPod/GPU
#!/bin/bash
# RunPod Full Setup - OCR Server (8765) + NSFW Server (8877)
# Usage: curl -sSL <gist_url>/raw | bash
# Saves to /workspace for persistence across restarts
set -e
cd /workspace
echo "============================================"
@Somberor
Somberor / server.py
Last active January 25, 2026 23:20
GPU OCR Server - EasyOCR with concurrent processing (50 workers)
"""
GPU OCR Server - FastAPI + EasyOCR
Run on a GPU server (RTX 3090, 4090, etc.) to provide fast OCR processing.
Usage:
pip install fastapi uvicorn easyocr pillow python-multipart
python server.py
The server will listen on port 8765 by default.
import io, time
from typing import Optional
import easyocr, numpy as np
from PIL import Image
from fastapi import FastAPI, File, UploadFile, HTTPException
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
app = FastAPI(title="GPU OCR Server")
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"])
ocr_reader: Optional[easyocr.Reader] = None