* Commit after creating the project * Add sherpa-onnx related files * copy and modify files from sherpa-ncnn * add app icon
47 lines
1.1 KiB
Swift
47 lines
1.1 KiB
Swift
//
|
|
// ContentView.swift
|
|
// SherpaOnnx
|
|
//
|
|
// Created by fangjun on 2023/4/5.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ContentView: View {
|
|
@StateObject var sherpaOnnxVM = SherpaOnnxViewModel()
|
|
|
|
var body: some View {
|
|
VStack {
|
|
Text("ASR with Next-gen Kaldi")
|
|
.font(.title)
|
|
if sherpaOnnxVM.status == .stop {
|
|
Text("See https://github.com/k2-fsa/sherpa-onnx")
|
|
Text("Press the Start button to run!")
|
|
}
|
|
ScrollView(.vertical, showsIndicators: true) {
|
|
HStack {
|
|
Text(sherpaOnnxVM.subtitles)
|
|
Spacer()
|
|
}
|
|
}
|
|
Spacer()
|
|
Button {
|
|
toggleRecorder()
|
|
} label: {
|
|
Text(sherpaOnnxVM.status == .stop ? "Start" : "Stop")
|
|
}
|
|
}
|
|
.padding()
|
|
}
|
|
|
|
private func toggleRecorder() {
|
|
sherpaOnnxVM.toggleRecorder()
|
|
}
|
|
}
|
|
|
|
struct ContentView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
ContentView()
|
|
}
|
|
}
|