Skip to content

Instantly share code, notes, and snippets.

View petitchamp's full-sized avatar

SONG Ke petitchamp

  • DASSAULT SYSTEMES
  • Paris,France
View GitHub Profile
@petitchamp
petitchamp / python-gcp-stt.md
Created February 2, 2023 11:03 — forked from ecovictoriano/python-gcp-stt.md
Transcribe audio file to text (speech-to-text) using Google Cloud Platform's Speech API

Transcribe audio file to text (speech-to-text) using Google Cloud Platform's Speech API

Convert audio to text using GCP Speech API

Requirements

pip install --upgrade google-cloud-speech

Export the GCP credential env and execute the request

#!/bin/bash
@petitchamp
petitchamp / test.py
Created October 2, 2017 21:29 — forked from christianroman/test.py
Bypass Captcha using 10 lines of code with Python, OpenCV & Tesseract OCR engine
import cv2.cv as cv
import tesseract
gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE)
cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY)
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz")
api.SetPageSegMode(tesseract.PSM_SINGLE_WORD)
tesseract.SetCvImage(gray,api)
print api.GetUTF8Text()