File tree Expand file tree Collapse file tree
mv3/android/MV3Demo/app/src/main/java/org/pytorch/executorchexamples/mv3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ class MainActivity : ComponentActivity() {
176176 onClick = {
177177 imagePickerLauncher.launch(" image/*" )
178178 },
179- enabled = ! isLiveCameraMode,
179+ enabled = ! isLiveCameraMode && modelReady ,
180180 modifier = Modifier .weight(1f )
181181 ) {
182182 Icon (
@@ -194,6 +194,7 @@ class MainActivity : ComponentActivity() {
194194 cameraPermissionLauncher.launch(Manifest .permission.CAMERA )
195195 }
196196 },
197+ enabled = modelReady,
197198 modifier = Modifier .weight(1f ),
198199 colors = IconButtonDefaults .iconButtonColors(
199200 containerColor = if (isLiveCameraMode) MaterialTheme .colorScheme.secondaryContainer else androidx.compose.ui.graphics.Color .Transparent
@@ -246,7 +247,11 @@ class MainActivity : ComponentActivity() {
246247 modifier = Modifier .fillMaxSize()
247248 )
248249 } else {
249- Text (" Pick an image to start or use Live Camera" , style = MaterialTheme .typography.bodyLarge)
250+ if (modelReady) {
251+ Text (" Pick an image to start or use Live Camera" , style = MaterialTheme .typography.bodyLarge)
252+ } else {
253+ Text (" Please download the model to start" , style = MaterialTheme .typography.bodyLarge)
254+ }
250255 }
251256 }
252257
You can’t perform that action at this time.
0 commit comments