feat: add food camera and recognition features
- Implemented FoodCameraScreen for capturing food images with meal type selection. - Created FoodRecognitionScreen for processing and recognizing food images. - Added Redux slice for managing food recognition state and results. - Integrated image upload functionality to cloud storage. - Enhanced UI components for better user experience during food recognition. - Updated FloatingFoodOverlay to navigate to the new camera screen. - Added food recognition service for API interaction. - Improved styling and layout for various components.
This commit is contained in:
34
services/foodRecognition.ts
Normal file
34
services/foodRecognition.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { api } from '@/services/api';
|
||||
|
||||
export type FoodNutritionData = {
|
||||
proteinGrams?: number;
|
||||
carbohydrateGrams?: number;
|
||||
fatGrams?: number;
|
||||
fiberGrams?: number;
|
||||
};
|
||||
|
||||
export type FoodConfirmationOption = {
|
||||
id: string;
|
||||
label: string;
|
||||
foodName: string;
|
||||
portion: string;
|
||||
calories: number;
|
||||
mealType: string;
|
||||
nutritionData: FoodNutritionData;
|
||||
};
|
||||
|
||||
export type FoodRecognitionRequest = {
|
||||
imageUrls: string[];
|
||||
};
|
||||
|
||||
export type FoodRecognitionResponse = {
|
||||
items: FoodConfirmationOption[];
|
||||
analysisText: string;
|
||||
confidence: number;
|
||||
isFoodDetected: boolean;
|
||||
nonFoodMessage?: string;
|
||||
};
|
||||
|
||||
export async function recognizeFood(request: FoodRecognitionRequest): Promise<FoodRecognitionResponse> {
|
||||
return api.post<FoodRecognitionResponse>('/ai-coach/food-recognition', request);
|
||||
}
|
||||
Reference in New Issue
Block a user