基于此代码,从 'firebase/app' 导入 { initialiseApp};从 'firebase/firestore' 导入 {getFirestore};从 'firebase/firestore' 导入 {collection, addDoc};从 '/...' 导入 jsonData
根据此代码,
import { initializeApp } from 'firebase/app';
import { getFirestore } from 'firebase/firestore';
import { collection, addDoc } from 'firebase/firestore';
import jsonData from '/Users/user/mobilegaitapp/app/(tabs)/data/o2-74-9.json'; // Import JSON data
import * as tf from '@tensorflow/tfjs';
import { fetch, bundleResourceIO } from '@tensorflow/tfjs-react-native';
// Initialize Firebase
const firebaseConfig = {
apiKey: "AIzaSyDVbz-aiY7qqn02fXvkVTvXkVfdB4Na5BU",
authDomain: "mobile-gait-app-41e79.firebaseapp.com",
projectId: "mobile-gait-app-41e79",
storageBucket: "mobile-gait-app-41e79.appspot.com",
messagingSenderId: "27863890269",
appId: "1:27863890269:web:cb928075afbac7720c10b4",
measurementId: "G-M4EDSXW7FV"
};
const app = initializeApp(firebaseConfig);
// Connect Firestore to your Expo-managed React Native App
const db = getFirestore(app);
export default function App() {
async function loadModel(){
console.log("[+] Application started")
// Wait for tensorflow module to be ready
await tf.ready();
console.log("[+] Loading custom mask detection model");
// Replace model.json and group1-shard.bin with your own custom model
const modelJson = require("/Users/user/mobilegaitapp/assets/model/model.json");
const modelWeight = require("/Users/user/mobilegaitapp/assets/model/group1- shard1of1.bin");
// Load model
const model = await tf.loadLayersModel(bundleResourceIO(modelJson, modelWeight));
console.log("[+] Custom mask detection model loaded");
}
loadModel();
return null;
}
当我尝试在 react native expo go 中部署我的深度学习模型时,此代码就在我的 index.tsx 文件中。
我有这个错误。
Android Bundling failed 4668ms node_modules/expo-router/entry.js (906 modules)
error: node_modules/expo-router/_ctx.android.js: /Users/user/mobilegaitapp/node_modules/expo-router/_ctx.android.js: Expected `fromDir` to be of type `string`, got `undefined`
我尝试升级该软件包但仍然无法升级。我不明白为什么我无法运行移动应用程序。