Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift UI upgrade?.. #3

Open
TIMBER2024 opened this issue Oct 26, 2024 · 1 comment
Open

Swift UI upgrade?.. #3

TIMBER2024 opened this issue Oct 26, 2024 · 1 comment

Comments

@TIMBER2024
Copy link
Owner

import UIKit
import CoreML
import Vision
import AVFoundation

class VideoProcessor: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate {

// The CoreML model, assuming you have a model named "YourModel"
private let model: YourModel = {
    do {
        let config = MLModelConfiguration()
        return try YourModel(configuration: config)
    } catch {
        fatalError("Failed to load the model: \(error)")
    }
}()

private var captureSession: AVCaptureSession?
private var request: VNCoreMLRequest?
private var videoOutput: AVCaptureVideoDataOutput?

override init() {
    super.init()
    setupCoreMLRequest()
    setupCaptureSession()
}

deinit {
    captureSession?.stopRunning()
}

func startVideoProcessing() {
    captureSession?.startRunning()
}

private func setupCoreMLRequest() {
    do {
        let visionModel = try VNCoreMLModel(for
@TIMBER2024
Copy link
Owner Author

Fix code string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant