A modern web application that helps users analyze product information and fruit freshness using AI-powered image recognition.
- Upload product images to detect:
- Brand name
- Expiry date
- Confidence score
- Powered by Hugging Face's Qwen model for accurate text extraction
- Drag-and-drop interface for easy image upload
- Analyze fruit images to determine:
- Freshness index (0-10 scale)
- Estimated days of freshness remaining
- Confidence score
- Uses Roboflow's trained model for precise freshness detection
- Supports both file upload and real-time camera capture
- Frontend Framework: React with TypeScript
- Styling: Tailwind CSS
- Icons: Lucide React
- Image Upload: React Dropzone
- Camera Integration: React Webcam
- AI Services:
- Hugging Face API (Qwen model)
- Roboflow API (Custom fruit freshness model)
Before you begin, ensure you have:
- Node.js (v16 or higher)
- npm or yarn
- API keys for:
- Hugging Face
- Roboflow
- Clone the repository:
git clone <repository-url>
cd product-freshness-analyzer- Install dependencies:
npm install- Create a
.envfile in the root directory:
VITE_HUGGING_FACE_API_KEY=your_huggingface_key_here
VITE_ROBOFLOW_API_KEY=your_roboflow_key_here- Start the development server:
npm run dev- Click on the "Product Analysis" tab
- Drag and drop a product image or click to select
- Wait for the AI to analyze the image
- View results in the table format
- Switch to the "Fruit Freshness" tab
- Choose between:
- Upload an image
- Use device camera
- Follow the prompts to capture or upload
- Review the freshness analysis results
src/
├── components/ # React components
│ ├── common/ # Shared components
│ ├── ProductAnalyzer/
│ └── FreshnessAnalyzer/
├── services/ # API integration
│ └── api/
├── config/ # Configuration files
├── types/ # TypeScript types
└── utils/ # Utility functions
The application includes comprehensive error handling:
- API connection issues
- Invalid image formats
- Missing API keys
- Failed analysis attempts
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
| Variable | Description | Required |
|---|---|---|
| VITE_HUGGING_FACE_API_KEY | Hugging Face API key | Yes |
| VITE_ROBOFLOW_API_KEY | Roboflow API key | Yes |
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
This project uses:
- ESLint for code linting
- Prettier for code formatting
- TypeScript for type safety
MIT License - see LICENSE file for details
- Hugging Face for their Qwen model
- Roboflow for fruit freshness detection
- Tailwind CSS for styling
- Lucide for icons
