Created
December 22, 2024 23:51
-
-
Save kunal732/94641d4b11e872f6dcc7e32e664f1d51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.swift | |
// Mac-PaliGemma2 | |
// | |
// Created by KUNAL BATRA on 12/22/24. | |
// | |
import SwiftUI | |
import MLXModelManager | |
struct ContentView: View { | |
@StateObject var manager = ModelManager(modelPath: "mlx-community/paligemma2-3b-ft-docci-448-8bit") | |
var body: some View { | |
VStack { | |
Button("Describe Image"){ | |
Task { | |
//load model | |
try await manager.loadModel() | |
//inference | |
await manager.generate( | |
prompt: "Describe this image.", | |
imagePath:"/Users/kunalbatra/Downloads/classic.png" | |
) | |
} | |
} | |
Text(manager.output) | |
} | |
.padding() | |
} | |
} | |
#Preview { | |
ContentView() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment