Skip to content

Commit

Permalink
fix build and test
Browse files Browse the repository at this point in the history
  • Loading branch information
ksyeo1010 committed Nov 23, 2023
1 parent 97b9896 commit d809e3d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ private void leopardCreate(@NonNull MethodCall call, @NonNull Result result) {
String accessKey = call.argument("accessKey");
String modelPath = call.argument("modelPath");
boolean enableAutomaticPunctuation = call.argument("enableAutomaticPunctuation");
boolean enableDiarization = call.argument("enableDiarization");

Leopard.Builder leopardBuilder = new Leopard.Builder()
.setAccessKey(accessKey)
.setModelPath(modelPath)
.setEnableAutomaticPunctuation(enableAutomaticPunctuation);
.setEnableAutomaticPunctuation(enableAutomaticPunctuation)
.setEnableDiarization(enableDiarization);

Leopard leopard = leopardBuilder.build(flutterContext);
leopardPool.put(String.valueOf(System.identityHashCode(leopard)), leopard);
Expand Down Expand Up @@ -219,6 +221,7 @@ private Map<String, Object> leopardTranscriptToMap(LeopardTranscript result) {
wordMap.put("confidence", word.getConfidence());
wordMap.put("startSec", word.getStartSec());
wordMap.put("endSec", word.getEndSec());
wordMap.put("speakerTag", word.getSpeakerTag());
words.add(wordMap);
}
resultMap.put("words", words);
Expand Down
5 changes: 4 additions & 1 deletion binding/flutter/ios/Classes/SwiftLeopardPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ public class SwiftLeopardPlugin: NSObject, FlutterPlugin {
if let accessKey = args["accessKey"] as? String,
let modelPath = args["modelPath"] as? String {
let enableAutomaticPunctuation = args["enableAutomaticPunctuation"] as? Bool
let enableDiarization = args["enableDiarization"] as? Bool

let leopard = try Leopard(
accessKey: accessKey,
modelPath: modelPath,
enableAutomaticPunctuation: enableAutomaticPunctuation ?? false
enableAutomaticPunctuation: enableAutomaticPunctuation ?? false,
enableDiarization: enableDiarization ?? false
)

let handle: String = String(describing: leopard)
Expand Down Expand Up @@ -139,6 +141,7 @@ public class SwiftLeopardPlugin: NSObject, FlutterPlugin {
wordMap["confidence"] = wordMeta.confidence
wordMap["startSec"] = wordMeta.startSec
wordMap["endSec"] = wordMeta.endSec
wordMap["speakerTag"] = wordMeta.speakerTag
wordMapArray.append(wordMap)
}
resultDictionary["words"] = wordMapArray
Expand Down
2 changes: 1 addition & 1 deletion demo/flutter/integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:leopard_flutter/leopard_error.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

final String accessKey = "Tw4jothrMMLyRYQ793yD/XF3DeithcbeNVsYlNN0Dc1vY26suWNOkg==";
final String accessKey = "{TESTING_ACCESS_KEY_HERE}";

String getModelPath(String language) {
return "assets/test_resources/model_files/leopard_params${language != "en" ? "_$language" : ""}.pv";
Expand Down

0 comments on commit d809e3d

Please sign in to comment.