Fixed Welcome Screen Issue
This commit is contained in:
parent
a1ace37271
commit
032c902606
@ -1,15 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = function (api) {
|
||||||
presets: ["babel-preset-expo", "@babel/preset-typescript"],
|
api.cache(true);
|
||||||
plugins: [
|
return {
|
||||||
[
|
presets: ["babel-preset-expo"],
|
||||||
"module:react-native-dotenv",
|
};
|
||||||
{
|
|
||||||
moduleName: "@env",
|
|
||||||
path: ".env",
|
|
||||||
safe: true,
|
|
||||||
allowUndefined: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"react-native-reanimated/plugin",
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,6 @@ import {
|
|||||||
ScrollView,
|
ScrollView,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import * as ImagePicker from "expo-image-picker";
|
import * as ImagePicker from "expo-image-picker";
|
||||||
import { API_KEY, MODEL_NAME } from "@env";
|
|
||||||
|
|
||||||
const ChipDetection = ({ updateChipCount }) => {
|
const ChipDetection = ({ updateChipCount }) => {
|
||||||
const [imageUri, setImageUri] = useState(null);
|
const [imageUri, setImageUri] = useState(null);
|
||||||
@ -62,11 +61,11 @@ const ChipDetection = ({ updateChipCount }) => {
|
|||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${API_KEY}`,
|
Authorization: `Bearer ${process.env.EXPO_PUBLIC_API_KEY}`,
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
model: MODEL_NAME,
|
model: process.env.EXPO_PUBLIC_MODEL_NAME,
|
||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
role: "system",
|
role: "system",
|
||||||
@ -103,12 +102,11 @@ const ChipDetection = ({ updateChipCount }) => {
|
|||||||
|
|
||||||
const parsedData = JSON.parse(cleanJSON);
|
const parsedData = JSON.parse(cleanJSON);
|
||||||
|
|
||||||
// Filter out colors with a count of 0
|
|
||||||
const filteredData = Object.fromEntries(
|
const filteredData = Object.fromEntries(
|
||||||
Object.entries(parsedData).filter(([_, count]) => count > 0)
|
Object.entries(parsedData).filter(([_, count]) => count > 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
setLastDetectedChips(filteredData); // Store detected chip counts
|
setLastDetectedChips(filteredData);
|
||||||
updateChipCount(filteredData);
|
updateChipCount(filteredData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setError("Failed to analyze the image.");
|
setError("Failed to analyze the image.");
|
||||||
|
1538
package-lock.json
generated
1538
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user