# Project export: FreshEye

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 11.0
- Tagline: Introducing FreshEye: Scan, store, and get expiration alerts for your food. Reduce waste, save money, and cook with confidence!
- Devpost: https://devpost.com/software/fresheye
- GitHub: https://github.com/SgtApone117/food_spoilage_management
- Video: https://www.youtube.com/embed/OlqOoDJI9bI?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 3 GitHub contributor(s) — fruiteyloops (13 commits), BLTA (4 commits), Dayfob (1 commits)

## Devpost submission (written by the team)

### Inspiration

As a frequent grocery shopper, we often found ourselves throwing away expired food and wasting money. According to the United Nations, one-third of all food produced globally is lost or wasted. We realized that many people face the same problem and that there must be a better way to manage food expiration dates. This sparked the idea for FreshEye, a mobile app designed to help users keep track of their food's freshness and reduce waste.

### What it does

FreshEye is an innovative mobile app that uses AI-powered computer vision to predict the shelf life of food. Here's how it works: Snap a photo: Simply take a picture of the food item using your smartphone camera. AI-powered analysis: Our cloud-based vision AI analyzes the image to identify the food type, its condition, and estimates its shelf life. Expiration prediction: FreshEye generates an estimated expiration date and time, so you know exactly when the food is likely to go bad. Reminders: Receive personalized reminders before the food expires, ensuring you use it before it's too late.

### How we built it

FreshEye was built using the following technologies: Mobile App: Flutter for building the Android app (iOS version coming soon!) Backend: Flask for building the RESTful API Languages: Dart for the mobile app, Python for the backend Version Control: GIT for managing code changes and collaborations Computer Vision: Google Cloud Vision API for image recognition and analysis Database: SQLite for storing food items and their expiration dates Architecture Here's a high-level overview of the architecture: The user takes a picture of the food item using the FreshEye mobile app. The image is sent to the Google Cloud Vision API for analysis. The API identifies the food type, its condition, and estimates its shelf life. The API sends the results back to the FreshEye backend. The backend stores the food item and its expiration date in the SQLite database. The backend sends the results back to the mobile app. The mobile app displays the expiration date and time to the user. The app sends reminders to the user before the food expires.

### Challenges we ran into

Food Detection and Classification: One of the biggest challenges we faced was accurately detecting the food item and classifying it correctly. This required fine-tuning the Google Cloud Vision API and training it on a large dataset of food images. Expiration Date Estimation: Estimating an accurate expiration date or shelf life was another challenge. We had to develop a complex algorithm that takes into account various factors such as food type, storage conditions, and handling practices. API Integration: Working with the Google Cloud Vision API and integrating it with our backend was a challenge. We had to handle errors, optimize API calls, and ensure seamless communication between the API and our app. Android Development: Building the mobile app for Android was also a challenge. We had to optimize the app for different screen sizes, handle device-specific issues, and ensure a smooth user experience. Accomplishments that we are proud of Food Detection: We are happy that we are able to detect food and also get rough estimate of expiration. User-Friendly Interface: We designed a user-friendly interface that makes it easy for users to take a picture of their food, view expiration dates, and receive reminders. Seamless API Integration: We successfully integrated the Google Cloud Vision API with our backend, ensuring seamless communication and good results. Robust Database Management: We designed a robust database management system using SQLite, allowing users to store and manage their food items and expiration dates efficiently. First Version Release: We successfully released the first version of FreshEye, marking a significant milestone in our project.

### What we learned

We learned a lot about the properties of many models as we needed to find a model that could suit our specific needs for the application There were a lot of things learned about API integration from the backend how we could connect it to the flutter frontend Some members learned about how to use Flutter for the first time and learned about mobile development and mobile deployment Flutter developing mainly and a lot of teamwork and how to produce the project, time management and some mobile development

### What's next

We're excited to continue improving and expanding FreshEye to make it an even more valuable tool for our users. Some of our future plans include: Expanding to iOS: We're working on releasing an iOS version of FreshEye to reach a wider audience. Adding More Features: We're exploring new features, such as integration with popular meal planning and grocery shopping apps, to enhance the user experience. Improving Accuracy: We're continually working to improve the accuracy of our food detection and expiration date estimation algorithms to ensure the best possible results for our users.

## README (from the GitHub repository)

# food_spoilage_management
Fresh food app stages:

1) Take a picture of the product

2) Then the app suppose to detect if the product is food or not 

3) If it is food, we present the user with what product is on the picture

4) The app goes into a python script that gets the approximate expiration range

5) We send that to backend

6) Backend calculates the date the product will expire 

7) Present that date on main screen

Main Contributors:
Summet 
Bexs
Ethan
Alikhan

## Detected evidence (automated analysis)

Indexed codebase: 33 recognized source files, 33 KB.
- C (language) — detected in the code
- C++ (language) — detected in the code
- Dart (language) — detected in the code
- HTML (language) — detected in the code
- Java (language) — detected in the code
- Kotlin (language) — detected in the code
- Python (language) — detected in the code
- Swift (language) — detected in the code
- Flask (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (120 of 260)

```
.gitignore
.vscode/fast_api/test.py
.vscode/settings.json
ai_detection/training.ipynb
eye_of_freshness/.dart_tool/chrome-device/Default/Affiliation Database
eye_of_freshness/.dart_tool/chrome-device/Default/Affiliation Database-journal
eye_of_freshness/.dart_tool/chrome-device/Default/AutofillStrikeDatabase/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/AutofillStrikeDatabase/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/AutofillStrikeDatabase/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/BrowsingTopicsSiteData
eye_of_freshness/.dart_tool/chrome-device/Default/BrowsingTopicsSiteData-journal
eye_of_freshness/.dart_tool/chrome-device/Default/BrowsingTopicsState
eye_of_freshness/.dart_tool/chrome-device/Default/BudgetDatabase/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/BudgetDatabase/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/BudgetDatabase/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/ClientCertificates/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/ClientCertificates/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/ClientCertificates/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/commerce_subscription_db/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/commerce_subscription_db/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/commerce_subscription_db/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/DIPS
eye_of_freshness/.dart_tool/chrome-device/Default/DIPS-journal
eye_of_freshness/.dart_tool/chrome-device/Default/discounts_db/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/discounts_db/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/discounts_db/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Download Service/EntryDB/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Download Service/EntryDB/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Download Service/EntryDB/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Extension Rules/000003.log
eye_of_freshness/.dart_tool/chrome-device/Default/Extension Rules/CURRENT
eye_of_freshness/.dart_tool/chrome-device/Default/Extension Rules/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Extension Rules/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Extension Rules/MANIFEST-000001
eye_of_freshness/.dart_tool/chrome-device/Default/Extension Scripts/000003.log
eye_of_freshness/.dart_tool/chrome-device/Default/Extension Scripts/CURRENT
eye_of_freshness/.dart_tool/chrome-device/Default/Extension Scripts/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Extension Scripts/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Extension Scripts/MANIFEST-000001
eye_of_freshness/.dart_tool/chrome-device/Default/Extension State/000003.log
eye_of_freshness/.dart_tool/chrome-device/Default/Extension State/CURRENT
eye_of_freshness/.dart_tool/chrome-device/Default/Extension State/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Extension State/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Extension State/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Extension State/MANIFEST-000001
eye_of_freshness/.dart_tool/chrome-device/Default/Favicons
eye_of_freshness/.dart_tool/chrome-device/Default/Favicons-journal
eye_of_freshness/.dart_tool/chrome-device/Default/Feature Engagement Tracker/AvailabilityDB/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Feature Engagement Tracker/AvailabilityDB/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Feature Engagement Tracker/AvailabilityDB/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Feature Engagement Tracker/EventDB/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Feature Engagement Tracker/EventDB/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Feature Engagement Tracker/EventDB/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/GCM Store/Encryption/000003.log
eye_of_freshness/.dart_tool/chrome-device/Default/GCM Store/Encryption/CURRENT
eye_of_freshness/.dart_tool/chrome-device/Default/GCM Store/Encryption/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/GCM Store/Encryption/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/GCM Store/Encryption/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/GCM Store/Encryption/MANIFEST-000001
eye_of_freshness/.dart_tool/chrome-device/Default/heavy_ad_intervention_opt_out.db
eye_of_freshness/.dart_tool/chrome-device/Default/heavy_ad_intervention_opt_out.db-journal
eye_of_freshness/.dart_tool/chrome-device/Default/History
eye_of_freshness/.dart_tool/chrome-device/Default/History-journal
eye_of_freshness/.dart_tool/chrome-device/Default/Local Storage/leveldb/000003.log
eye_of_freshness/.dart_tool/chrome-device/Default/Local Storage/leveldb/CURRENT
eye_of_freshness/.dart_tool/chrome-device/Default/Local Storage/leveldb/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Local Storage/leveldb/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Local Storage/leveldb/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Local Storage/leveldb/MANIFEST-000001
eye_of_freshness/.dart_tool/chrome-device/Default/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Login Data
eye_of_freshness/.dart_tool/chrome-device/Default/Login Data For Account
eye_of_freshness/.dart_tool/chrome-device/Default/Login Data For Account-journal
eye_of_freshness/.dart_tool/chrome-device/Default/Login Data-journal
eye_of_freshness/.dart_tool/chrome-device/Default/MediaDeviceSalts
eye_of_freshness/.dart_tool/chrome-device/Default/MediaDeviceSalts-journal
eye_of_freshness/.dart_tool/chrome-device/Default/Network Action Predictor
eye_of_freshness/.dart_tool/chrome-device/Default/Network Action Predictor-journal
eye_of_freshness/.dart_tool/chrome-device/Default/Network/Cookies
eye_of_freshness/.dart_tool/chrome-device/Default/Network/Cookies-journal
eye_of_freshness/.dart_tool/chrome-device/Default/Network/Network Persistent State
eye_of_freshness/.dart_tool/chrome-device/Default/Network/NetworkDataMigrated
eye_of_freshness/.dart_tool/chrome-device/Default/Network/Reporting and NEL
eye_of_freshness/.dart_tool/chrome-device/Default/Network/Reporting and NEL-journal
eye_of_freshness/.dart_tool/chrome-device/Default/Network/TransportSecurity
eye_of_freshness/.dart_tool/chrome-device/Default/Network/Trust Tokens
eye_of_freshness/.dart_tool/chrome-device/Default/Network/Trust Tokens-journal
eye_of_freshness/.dart_tool/chrome-device/Default/optimization_guide_hint_cache_store/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/optimization_guide_hint_cache_store/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/optimization_guide_hint_cache_store/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/parcel_tracking_db/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/parcel_tracking_db/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/parcel_tracking_db/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/PersistentOriginTrials/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/PersistentOriginTrials/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/PersistentOriginTrials/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Preferences
eye_of_freshness/.dart_tool/chrome-device/Default/PreferredApps
eye_of_freshness/.dart_tool/chrome-device/Default/README
eye_of_freshness/.dart_tool/chrome-device/Default/Safe Browsing Network/NetworkDataMigrated
eye_of_freshness/.dart_tool/chrome-device/Default/Safe Browsing Network/Safe Browsing Cookies
eye_of_freshness/.dart_tool/chrome-device/Default/Safe Browsing Network/Safe Browsing Cookies-journal
eye_of_freshness/.dart_tool/chrome-device/Default/Secure Preferences
eye_of_freshness/.dart_tool/chrome-device/Default/Segmentation Platform/SegmentInfoDB/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Segmentation Platform/SegmentInfoDB/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Segmentation Platform/SegmentInfoDB/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Segmentation Platform/SignalDB/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Segmentation Platform/SignalDB/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Segmentation Platform/SignalDB/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Segmentation Platform/SignalStorageConfigDB/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Segmentation Platform/SignalStorageConfigDB/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Segmentation Platform/SignalStorageConfigDB/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Service Worker/Database/000003.log
eye_of_freshness/.dart_tool/chrome-device/Default/Service Worker/Database/CURRENT
eye_of_freshness/.dart_tool/chrome-device/Default/Service Worker/Database/LOCK
eye_of_freshness/.dart_tool/chrome-device/Default/Service Worker/Database/LOG
eye_of_freshness/.dart_tool/chrome-device/Default/Service Worker/Database/LOG.old
eye_of_freshness/.dart_tool/chrome-device/Default/Service Worker/Database/MANIFEST-000001
[140 more files omitted for size]
```

### Dependencies

No dependency index available.

### Recent commits (newest first)

- Merge pull request #12 from SgtApone117/date_calculation
- Trying to re-add test_analyze.py
- Merge pull request #11 from SgtApone117/date_calculation
- image recognition works on backend!
- flask backend implemented
- Added readme
- Merge pull request #9 from SgtApone117/sumeet_data_set_1_0
- Cloud api
- Added some files
- add vision api
- Flutter app to click pictures online
- Merge pull request #2 from SgtApone117/fast_api_improvements
- Flutter app can now properly interact with backend!
- backend is working, just need better arguments
- setup test.py
- Merge pull request #1 from SgtApone117/fast_api
- More stuff added to fast API
- setup fast api
- Added dio packages
- added initial AI part

## Key source files (fetched from GitHub, selected and truncated for size)

### fast_api/main.py

```python
from fastapi import FastAPI
from pydantic import BaseModel
import httpx  

app = FastAPI()

class ProductRequest(BaseModel):
    product: str

# This route in FastAPI will forward the request to Flask's /getexpiration route
@app.post("/checkexpiration")
async def check_expiration(product_request: ProductRequest):
    # The product sent from the client (Flutter app)
    product = product_request.product

    # Flask URL where we'll forward the request
    flask_url = "http://127.0.0.1:5000/getexpiration"

    # Make an asynchronous POST request to the Flask API
    async with httpx.AsyncClient() as client:
        response = await client.post(flask_url, json={"product": product})

    # Return the Flask response to the FastAPI client
    return response.json()

@app.get("/")
async def root():
    return {"message": "FastAPI is forwarding requests to Flask!"}
```

### fast_api/test_main.py

```python
from fastapi.testclient import TestClient
import json
from main import app  # Import the FastAPI app from your main.py

client = TestClient(app)

def test_start_endpoint():
    # Load the test data from the JSON file
    with open("test_data.json", "r") as f:
        json_data = json.load(f)

    # Send a POST request to the /start endpoint with the loaded JSON data
    response = client.post("/start", json=json_data)

    # Check if the response status code is 200 OK
    assert response.status_code == 200

    # Check if the response body contains the expected value
    assert response.json() == {"foodtype": "test"}
```

### fast_api/test.py

```python
import requests

# Define the URL of the API
url = '127.0.0.1:5000'  # Ensure the port matches where your FastAPI app is running

# Define the headers
headers = {
    'Content-Type': 'application/json'
}

# Define the JSON body
data = {
    'product': 'pizza'
}

# Make a POST request to the API with headers and JSON body
response = requests.post(url, headers=headers, json=data)

# Check the status code of the response
if response.status_code == 200:
    print('Request was successful!')
    # Print the response content
    print('Response:', response.text)
else:
    print('Request failed with status code:', response.status_code)
    print('Response:', response.text)

```

### fast_api/test_date.py

```python
import requests

# Define the URL of the API
url = '127.0.0.1:5000'  # Ensure the port matches where your FastAPI app is running

# Define the headers
headers = {
    'Content-Type': 'application/json'
}

# Define the JSON body
data = {
    'product': 'pizza'
    'expiration'
}

# Make a POST request to the API with headers and JSON body
response = requests.post(url, headers=headers, json=data)

# Check the status code of the response
if response.status_code == 200:
    print('Request was successful!')
    # Print the response content
    print('Response:', response.text)
else:
    print('Request failed with status code:', response.status_code)
    print('Response:', response.text)

```

### eye_of_freshness/pubspec.yaml

```yaml
name: fresh_ai
description: A new Flutter project.

version: 1.0.0+1

environment:
  sdk: ">=3.0.0 <4.0.0"

dependencies:
  flutter:
    sdk: flutter
  camera: ^0.9.4+5
  path_provider: ^2.0.4
  path: ^1.8.0
  dio: ^5.7.0
  http: 1.2.2
  image_picker: ^0.8.4+4

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^3.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:
  uses-material-design: true
  assets:
   - assets/profile_default.jpg

```

### fast_api/test_analyze.py

```python
import requests
import base64 #g

def encode_image_to_base64(image_path):
    # Open the image file in binary mode
    with open(image_path, "rb") as image_file:
        # Read the image data
        image_data = image_file.read()
        # Encode the image data to base64
        base64_encoded_data = base64.b64encode(image_data)
        # Convert the base64 encoded data to a string
        base64_encoded_string = base64_encoded_data.decode('utf-8')
    return base64_encoded_string

# Example usage
image_path = 'C:\\Users\\donle\\Downloads\\food_spoilage_management\\fast_api\\classic-cheese-pizza-FT-RECIPE0422-31a2c938fc2546c9a07b7011658cfd05.jpg'
encoded_image = encode_image_to_base64(image_path)

# Define the URL of the API
url = 'http://127.0.0.1:5000/analyze'  # Ensure the port matches where your FastAPI app is running

# Define the headers
headers = {
    'Content-Type': 'application/json'
}

# Define the JSON body
data = { 
    "image": encoded_image
}

# Make a POST request to the API with headers and JSON body
response = requests.post(url, headers=headers, json=data)

# Check the status code of the response
if response.status_code == 200:
    print('Request was successful!')
    # Print the response content
    print('Response:', response.text)
else:
    print('Request failed with status code:', response.status_code)
    print('Response:', response.text)

```

### eye_of_freshness/analysis_options.yaml

```yaml
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
  # The lint rules applied to this project can be customized in the
  # section below to disable rules from the `package:flutter_lints/flutter.yaml`
  # included above or to enable additional rules. A list of all available lints
  # and their documentation is published at https://dart.dev/lints.
  #
  # Instead of disabling a lint rule for the entire project in the
  # section below, it can also be suppressed for a single line of code
  # or a specific dart file by using the `// ignore: name_of_lint` and
  # `// ignore_for_file: name_of_lint` syntax on the line or in the file
  # producing the lint.
  rules:
    # avoid_print: false  # Uncomment to disable the `avoid_print` rule
    # prefer_single_quotes: true  # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

```

### fast_api/expiration_calculation.py

```python
from flask import Flask, request, jsonify
import requests

# Define the URL of the Google Vision API
url = 'https://vision.googleapis.com/v1/images:annotate?key='  # Replace with your actual API key

# Define the headers for the Google Vision API
headers = {
    'Content-Type': 'application/json'
}

app = Flask(__name__)

# Sample product expiration database
expirationdb = {
    "milk": "7 days",
    "bread": "5 days",
    "yogurt": "14 days",
    "apple": "30 days",
    "meat": "3 days"
}

@app.route('/analyze', methods=['POST'])
def analyze_image():
    # Get the base64-encoded image from the request
    data = request.json
    image_base64 = data.get('image')

    # Return an error if no image data is provided
    if not image_base64:
        return jsonify({"error": "No image data provided"}), 400

    # Define the JSON body for the Google Vision API request
    vision_data = {
        "requests": [
            {
                "image": {
                    "content": image_base64,  # Base64 image
                },
                "features": [
                    {
                        "type": "LABEL_DETECTION",  # Feature type for image analysis
                        "maxResults": 10,
                    },
                ],
            }
        ]
    }

    # Make a POST request to the Google Vision API
    response = requests.post(url, headers=headers, json=vision_data)

    # Check if the request was successful
    if response.status_code == 200:
        # Parse the response from Google Vision API
        vision_response = response.json()

        # Return the response from Google Vision API to the client
        return jsonify({
            "message": "Image analysis complete",
            "vision_response": vision_response  # Include the actual response from Google Vision API
        })
    else:
        # If the request to Google Vision API fails, return an error message
        return jsonify({
            "error": "Image analysis failed",
            "status_code": response.status_code,
            "response": response.text
        }), response.status_code

# API route to process product text
@app.route('/getexpiration', methods=['POST'])
def get_expiration():
    data = request.json
    product_text = data['product'].lower()  # Convert product text to lowercase
    expiration = expirationdb.get(product_text, "Unknown expiration range")  # Lookup expiration

    return jsonify({"product": product_text, "expiration": expiration})

if __name__ == '__main__':
    app.run(debug=True, port=5000)

```

### .vscode/fast_api/test.py

```python
import requests

# Define the URL of the API
url = 'http://127.0.0.1/start'

# Define the headers
headers = {
    'Content-Type': 'application/json'
}

# Make a GET request to the API with headers
response = requests.get(url, headers=headers)

# Check the status code of the response
if response.status_code == 200:
    print('Request was successful!')
    # Print the response content
    print('Response:', response.text)
else:
    print('Request failed with status code:', response.status_code)
```

### eye_of_freshness/web/index.html

```html
<!DOCTYPE html>
<html>
<head>
  <!--
    If you are serving your web app in a path other than the root, change the
    href value below to reflect the base path you are serving from.

    The path provided below has to start and end with a slash "/" in order for
    it to work correctly.

    For more details:
    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

    This is a placeholder for base href that will be replaced by the value of
    the `--base-href` argument provided to `flutter build`.
    <base href="$FLUTTER_BASE_HREF">
  -->

  <meta charset="UTF-8">
  <meta content="IE=Edge" http-equiv="X-UA-Compatible">
  <meta name="description" content="A new Flutter project.">

  <!-- iOS meta tags & icons -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="hello_world">
  <link rel="apple-touch-icon" href="icons/Icon-192.png">

  <!-- Favicon -->
  <link rel="icon" type="image/png" href="favicon.png"/>

  <title>hello_world</title>
  <link rel="manifest" href="manifest.json">

  <script>
    // The value below is injected by flutter build, do not touch.
    const serviceWorkerVersion = null;
  </script>
  <!-- This script adds the flutter initialization JS code -->
  <script src="flutter.js" defer></script>
</head>
<body>
  <script>
    window.addEventListener('load', function(ev) {
      // Download main.dart.js
      _flutter.loader.loadEntrypoint({
        serviceWorker: {
          serviceWorkerVersion: serviceWorkerVersion,
        },
        onEntrypointLoaded: function(engineInitializer) {
          engineInitializer.initializeEngine().then(function(appRunner) {
            appRunner.runApp();
          });
        }
      });
    });
  </script>
</body>
</html>

```

[20 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]