https://github.com/ggerganov/whisper.cpp/tree/master/examples/server
- whisper.cpp setup
- server build and run
$ make server
$ ./server -m ./models/ggml-large-v3.bin -l ja
https://github.com/ggerganov/whisper.cpp/tree/master/examples/server
$ make server
$ ./server -m ./models/ggml-large-v3.bin -l ja
import SwiftUI | |
import PDFKit | |
let pdfRendererFormat = [ | |
kCGPDFContextCreator: "@mbotsu", | |
kCGPDFContextAuthor: "@mbotsu", | |
kCGPDFContextTitle: "Create multi-page PDFs with SwiftUI layouts", | |
kCGPDFContextSubject: "Give up ImageRenderer and create PDFs with UIGraphicsPDFRenderer", | |
] as [String : Any] |
import SwiftUI | |
import PDFKit | |
let pdfRendererFormat = [ | |
kCGPDFContextCreator: "@mbotsu", | |
kCGPDFContextAuthor: "@mbotsu", | |
kCGPDFContextTitle: "Create multi-page PDFs with SwiftUI layouts", | |
kCGPDFContextSubject: "Give up ImageRenderer and create PDFs with UIGraphicsPDFRenderer", | |
] as [String : Any] |
import SwiftUI | |
import Charts | |
struct CreateImageView: View { | |
@State var uiImage: UIImage? | |
var body: some View { | |
VStack { | |
if let uiImage = uiImage { | |
Image(uiImage: uiImage) | |
} |
import SwiftUI | |
import PDFKit | |
let pdfRendererFormat = [ | |
kCGPDFContextCreator: "@mbotsu", | |
kCGPDFContextAuthor: "@mbotsu", | |
kCGPDFContextTitle: "Create multi-page PDFs with SwiftUI layouts", | |
kCGPDFContextSubject: "Give up ImageRenderer and create PDFs with UIGraphicsPDFRenderer", | |
] as [String : Any] |
import SwiftUI | |
import PDFKit | |
let pdfDocumentOptions = [ | |
kCGPDFContextCreator: "@mbotsu", | |
kCGPDFContextAuthor: "@mbotsu", | |
kCGPDFContextTitle: "Create and combine PDFs with SwiftUI layouts", | |
kCGPDFContextSubject: "Give up ImageRenderer and create PDFs with UIGraphicsPDFRenderer", | |
] as [PDFDocumentWriteOption : Any] |
import SwiftUI | |
struct ContentView: View { | |
@State var pdfUrl: URL? | |
var body: some View { | |
VStack { | |
if let pdfUrl = pdfUrl { | |
PreviewView(url: pdfUrl) | |
} | |
} |
// https://github.com/opencv/opencv/blob/master/modules/imgcodecs/src/ios_conversions.mm | |
// https://github.com/opencv/opencv/blob/master/modules/imgcodecs/src/apple_conversions.mm | |
func MatToCGImage(image:Mat) -> CGImage? { | |
let data = Data(bytes: image.dataPointer(), count: image.step1() * Int(image.rows())) | |
let colorSpace = image.elemSize() == 1 ? CGColorSpaceCreateDeviceGray() : CGColorSpaceCreateDeviceRGB() | |
let provider = CGDataProvider(data: data as CFData); | |
let alpha = image.channels() == 4; | |
let bitmapInfo: CGBitmapInfo = CGBitmapInfo(rawValue: (alpha ? CGImageAlphaInfo.last : CGImageAlphaInfo.none).rawValue | CGBitmapInfo.byteOrderDefault.rawValue) |
import SwiftUI | |
import WebKit | |
enum WebViewError: Error { | |
case contentConversion(String) | |
case emptyFileName | |
case inivalidFilePath | |
var message: String { | |
switch self { |
import sys | |
import cv2 | |
import numpy as np | |
import tensorflow as tf | |
def preprocess_input(image_name, height, width): | |
src = cv2.imread(image_name, cv2.IMREAD_GRAYSCALE) | |
ratio = float(src.shape[1]) / float(src.shape[0]) | |
tw = int(height * ratio) | |
rsz = cv2.resize(src, (tw, height), interpolation=cv2.INTER_AREA).astype(np.float32) |