# Project export: AudibleEyes

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: Helping visually impaired individuals navigate with real-time smart vision powered by fine-tuned multimodal agents, dynamical system analysis, and Voice AI, all integrated with Rayban Meta glasses.
- Devpost: https://devpost.com/software/audible
- GitHub: https://github.com/EulerPascal404/vision-2.0
- Video: https://www.youtube.com/embed/OpaSg1PhFU0?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 3 GitHub contributor(s) — EulerPascal404 (23 commits), Nicole (11 commits), Joe Li (3 commits)

## Devpost submission (written by the team)

### Inspiration

The inspiration behind AudibleEyes stems from a deep-rooted desire to empower visually impaired individuals to navigate the world freely. Rather than sketching out a proof of concept, we wanted to build a concrete system that is practical, human-centric, and immediately usable, working both for the wearers and their caretakers. We also wanted to incorporate deep physics to have an accurate navigation system that goes beyond AI pipelines, eliminating the risks of hallucination, which can be very dangerous for visually impaired people using AudibleEyes. Our vision is a world where no one lacks the ability to experience and navigate the world due to visual impairment. What It Does + How We Built It AudibleEyes Smart Glasses help visually impaired people navigate real-time scenarios using fine-tuned depth estimation (Intel ISL’s MiDaS), object segmentation (YOLOv5), and fine-tuned LLMs (Gemini), combined with deep Newtonian analysis of physical dynamical systems. All these components are integrated through a LangChain graph, generating voice-based navigation assistance delivered directly to the wearer’s ears. Additionally, our app allows users and their caretakers to view an annotated visual map and receive audio navigation assistance. We are the first in the world to build an AI navigation system for Meta Rayban glasses, despite the lack of developer tools. We bootstrapped a custom PHP server that allows AudibleEyes to work. When the user prompts the Meta glasses with a navigation request, the glasses snap a photo and send it to a WhatsApp developer bot API, which transmits it to a PHP server before passing the image to our LangChain. Our LangChain uses multimodal agents to analyze the photo, employing fine-tuned YOLOv5 for object detection and segmentation, generating a depth map with Intel ISL’s MiDaS, and performing semantic scene analysis. The final result is processed through the Gemini API, which synthesizes the optimal path. To ensure safety, we combine machine learning-based path prediction with physical dynamical systems and differential equations to predict collisions and repulsions using Potential Fields and Newtonian-cost-based optimization. The final path is sent back to the PHP server and connected to the Meta glasses via WhatsApp. Meta AI then reads the Gemini-generated summary to the user. The path and the original image are also sent to a web app built using Streamlit for caretakers to monitor or for users to review (fully compatible with screen readers). We used Cartesia’s Voice AI to convert text descriptions into speech. Our project consolidates data from various sources into a single interface, offering real-time updates and comprehensive situational awareness – it acts as people’s eyes. This isn’t just navigation; it’s independence for millions. Tools & Building Blocks Machine Learning & Computer Vision: LangChain YOLOv5 Intel ISL MiDaS Google Gemini PyTorch LangChain YOLOv5 Intel ISL MiDaS Google Gemini PyTorch Custom Pipeline: Flask PHP WhatsApp API Flask PHP WhatsApp API Frontend Integration: Streamlit.io Streamlit.io Text-to-Speech: Cartesia Cartesia Challenges We Ran Into We faced significant challenges working with Ray-Ban Meta smart glasses, which lack a development kit (SDK). Without the ability to register custom commands or retrieve inputs, we created a workaround by transmitting data via WhatsApp, building a custom bot to send data to a PHP server. This allowed us to integrate real-time data analysis into our navigation system. Accomplishments We’re Proud Of Pioneering Innovation: First AI navigation system specifically for Meta Rayban glasses, which doesn't have a development kit. Custom PHP Server and WhatsApp Bot: Built a custom server and bot to bridge the gap between hardware and software, overcoming the lack of an SDK. Meaningful Impact: Increasing the quality of life for visually-impaired individuals with a seamless, practical solution. Advanced Multimodal Agents with Dynamical System Analysis: Fine tuned LangChain agents, incorporating physical dynamical analysis beyond basic object detection. Seamless User Experience: Completely automated system requiring no manual effort from the user. What’s Next for AudibleEyes Incorporating GPS location tracking and outdoor navigation guidance. Live-streamed video input feed with synced instructions. Adding personal safety features like voice-activated alerts and automatic crime detection to contact emergency services.

## README (from the GitHub repository)

# CalHacks 10.0 -- Audible Eyes

AudibleEyes empowers visually impaired individuals  to navigate in real-time using Rayban Meta glasses with audio guidance. AudibleEyes reads out the ideal path by leveraging multimodal LangChain agents along with Gemini for object segmentation, depth mapping, and dynamical system analysis through a custom-built pipeline.


## Detected evidence (automated analysis)

Indexed codebase: 567 recognized source files, 6935 KB.
- CSS (language) — detected in the code
- Flask (technology) — detected in the code
- Hugging Face (technology) — detected in the code
- LangChain (technology) — detected in the code
- PHP (language) — detected in the code
- Python (language) — detected in the code
- PyTorch (technology) — detected in the code

## Codebase structure (from repository index)

### Files (120 of 616)

```
.DS_Store
.gitignore
assets/.DS_Store
assets/styles.css
calhacks/__init__.py
calhacks/.DS_Store
calhacks/app_state.py
calhacks/backend/__init__.py
calhacks/backend/table_state.py
calhacks/calhacks.py
calhacks/components/__init__.py
calhacks/components/card.py
calhacks/components/navbar.py
calhacks/components/notification.py
calhacks/components/profile_input.py
calhacks/components/sidebar.py
calhacks/components/sonic.pcm
calhacks/components/status_badge.py
calhacks/components/voice_test.py
calhacks/pages/__init__.py
calhacks/pages/about.py
calhacks/pages/index.py
calhacks/pages/login.py
calhacks/pages/profile.py
calhacks/pages/settings.py
calhacks/pages/table.py
calhacks/styles.py
calhacks/templates/__init__.py
calhacks/templates/template.py
calhacks/test.php
calhacks/views/__init__.py
calhacks/views/adquisition_view.py
calhacks/views/charts.py
calhacks/views/color_picker.py
calhacks/views/radius_picker.py
calhacks/views/scaling_picker.py
calhacks/views/stats_cards.py
calhacks/views/table.py
data/sample_data.txt
gemini_to_text.py
greq.txt
IMG_8674.heic
items.csv
joe_req.txt
lang_graph.py
meta_glasses/bin/python
meta_glasses/bin/python3
meta_glasses/bin/python3.9
meta_glasses/lib/python3.9/site-packages/_distutils_hack/__init__.py
meta_glasses/lib/python3.9/site-packages/_distutils_hack/override.py
meta_glasses/lib/python3.9/site-packages/distutils-precedence.pth
meta_glasses/lib/python3.9/site-packages/pip-21.2.3.dist-info/entry_points.txt
meta_glasses/lib/python3.9/site-packages/pip-21.2.3.dist-info/LICENSE.txt
meta_glasses/lib/python3.9/site-packages/pip-21.2.3.dist-info/METADATA
meta_glasses/lib/python3.9/site-packages/pip-21.2.3.dist-info/RECORD
meta_glasses/lib/python3.9/site-packages/pip-21.2.3.dist-info/top_level.txt
meta_glasses/lib/python3.9/site-packages/pip-21.2.3.dist-info/WHEEL
meta_glasses/lib/python3.9/site-packages/pip/__init__.py
meta_glasses/lib/python3.9/site-packages/pip/__main__.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/__init__.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/build_env.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cache.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/__init__.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/base_command.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/command_context.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/main.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/parser.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/req_command.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/spinners.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/status_codes.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/__init__.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/cache.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/check.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/completion.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/configuration.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/debug.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/download.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/freeze.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/hash.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/help.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/index.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/install.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/list.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/search.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/show.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/uninstall.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/wheel.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/configuration.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/distributions/__init__.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/distributions/base.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/distributions/installed.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/distributions/sdist.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/distributions/wheel.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/exceptions.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/index/__init__.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/index/collector.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/index/package_finder.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/index/sources.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/locations/__init__.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/locations/_sysconfig.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/locations/base.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/main.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/metadata/__init__.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/metadata/base.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/metadata/pkg_resources.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/models/__init__.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/models/candidate.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/models/direct_url.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/models/format_control.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/models/index.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/models/link.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/models/scheme.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/models/search_scope.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/models/selection_prefs.py
meta_glasses/lib/python3.9/site-packages/pip/_internal/models/target_python.py
[496 more files omitted for size]
```

### Dependencies

- requirements.txt: aiohappyeyeballs@==2.4.3, aiohttp@==3.10.10, aiosignal@==1.3.1, annotated-types@==0.7.0, anyio@==4.6.2.post1, apispec@==6.6.1, async-timeout@==4.0.3, attrs@==24.2.0, bech32@==1.2.0, blinker@==1.8.2, cachetools@==5.5.0, cartesia, certifi@==2024.8.30, charset-normalizer@==3.4.0, click@==8.1.7, clip, cosmpy@==0.9.2, dataclasses-json@==0.6.7, ecdsa@==0.19.0, exceptiongroup@==1.2.2, filelock@==3.16.1, Flask@==3.0.3, frozenlist@==1.4.1, fsspec@==2024.9.0, ftfy, google-ai-generativelanguage@==0.6.10, google-api-core@==2.21.0, google-api-python-client@==2.149.0, google-auth@==2.35.0, google-auth-httplib2@==0.2.0, google-generativeai@==0.8.3, googleapis-common-protos@==1.56.2, greenlet@==3.1.1, grpcio@==1.67.0, grpcio-status@==1.67.0, h11@==0.14.0, httpcore@==1.0.6, httplib2@==0.22.0, httpx@==0.27.2, httpx-sse@==0.4.0, idna@==3.10, importlib_metadata@==8.5.0, itsdangerous@==2.2.0, Jinja2@==3.1.4, jsonpatch@==1.33, jsonpointer@==3.0.0, jsonschema@==4.23.0, jsonschema-specifications@==2024.10.1, langchain@==0.3.4, langchain-community@==0.3.3, langchain-core@==0.3.12, langchain-google-genai@==2.0.1, langchain-text-splitters@==0.3.0, langgraph, opencv-python, pillow, protobuf@==3.20.3, regex, timm, torch, tqdm, transformers

### Recent commits (newest first)

- Update README.md
- Hotel image
- Image 2
- No arrows
- All sample data
- added demo images
- finalized webapp frontend, added demo images
- gupta local req.txt
- Update requirements.txt
- update requirements
- php updates
- ML pipeline
- Merge branch 'main' of https://github.com/EulerPascal404/vision-2.0
- Images
- webapp
- webapp
- updated ml
- ML works before voice
- Push req
- Updated code

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

### requirements.txt

```
aiohappyeyeballs==2.4.3
aiohttp==3.10.10
aiosignal==1.3.1
annotated-types==0.7.0
anyio==4.6.2.post1
apispec==6.6.1
async-timeout==4.0.3
attrs==24.2.0
bech32==1.2.0
blinker==1.8.2
cachetools==5.5.0
certifi==2024.8.30
charset-normalizer==3.4.0
click==8.1.7
clip
cosmpy==0.9.2
dataclasses-json==0.6.7
ecdsa==0.19.0
exceptiongroup==1.2.2
filelock==3.16.1
Flask==3.0.3
frozenlist==1.4.1
fsspec==2024.9.0
google-ai-generativelanguage==0.6.10
google-api-core==2.21.0
google-api-python-client==2.149.0
google-auth==2.35.0
google-auth-httplib2==0.2.0
google-generativeai==0.8.3
googleapis-common-protos==1.56.2
greenlet==3.1.1
grpcio==1.67.0
grpcio-status==1.67.0
h11==0.14.0
httpcore==1.0.6
httplib2==0.22.0
httpx==0.27.2
httpx-sse==0.4.0
idna==3.10
importlib_metadata==8.5.0
itsdangerous==2.2.0
Jinja2==3.1.4
jsonpatch==1.33
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
langchain==0.3.4
langchain-community==0.3.3
langchain-core==0.3.12
langchain-google-genai==2.0.1
langchain-text-splitters==0.3.0
langgraph
torch 
opencv-python
pillow 
timm 
ftfy 
regex 
tqdm 
clip 
transformers
googleapis-common-protos==1.56.2 
protobuf==3.20.3
cartesia

```

### php_commands/composer.json

```
{
    "require": {
        "openai-php/client": "^0.8.1",
        "symfony/http-client": "^6.4",
        "nyholm/psr7": "^1.8",
        "google-gemini-php/client": "^1.0",
        "guzzlehttp/guzzle": "^7.9"
    },
    "config": {
        "allow-plugins": {
            "php-http/discovery": true
        }
    }
}

```

### calhacks/pages/index.py

```python
"""The main page of the app."""

import reflex as rx
from calhacks import styles
from calhacks.templates.template import template
from calhacks.app_state import AppState
# from calhacks.components.navbar import navbar  # Import the navbar component


@template(route="/", title="MetaEye - Navigational Guidance")
def index() -> rx.Component:
    """The main page displaying navigational guidance."""
    
    async def load_summaries():
        await AppState.load_latest_summary()
        await AppState.load_past_results()

    return rx.fragment(
        rx.box(
            rx.box(
                rx.vstack(
                    rx.box(
                        rx.heading(
                            "Latest Summary",
                            size="2xl",
                            text_align="left",
                            color=styles.primary_color,
                            margin_bottom="1rem",
                        ),
                        rx.box(
                            rx.text(
                                AppState.summary_text | "No summary available.",
                                size="md",
                                color=styles.text_color,
                                style={
                                    "padding": "1.5rem",
                                    "backgroundColor": styles.card_bg_color,
                                    "borderRadius": "8px",
                                    "boxShadow": styles.box_shadow,
                                },
                            ),
                        ),
                        rx.hstack(
                            rx.button(
                                "Listen",
                                on_click=AppState.speak_summary,
                                size="lg",
                                color_scheme="teal",
                                # left_icon=rx.icon("volume-2", color="white"),
                                aria_label="Listen to the summary",
                            ),
                            rx.button(
                                "Refresh",
                                on_click=AppState.load_latest_summary,
                                size="lg",
                                color_scheme="blue",
                                # left_icon=rx.icon("refresh-ccw", color="white"),
                                aria_label="Refresh summary",
                            ),
                            spacing="1rem",
                            margin_top="1rem",
                            justify="center",
                        ),
                        width="100%",
                    ),
                    rx.divider(margin_y="2rem"),
                    rx.heading(
                        "Past Summaries",
                        size="2xl",
                        text_align="left",
                        color=styles.primary_color,
                        margin_bottom="1rem",
                    ),
                    rx.box(
                        rx.foreach(
                            AppState.past_results,
                            lambda summary: rx.box(
                                rx.text(
                                    summary,
                                    size="md",
                                    color=styles.text_color,
                                    style={
                                        "padding": "1rem",
                                        "backgroundColor": styles.card_bg_color,
                                        "borderRadius": "8px",
                                        "margin_bottom": "1rem",
                                        "boxShadow": styles.box_shadow,
                                    },
                                )
                            ),
                        ),
                        width="100%",
                    ),
                ),
            ),
            width="100%",
            max_width="800px",
            margin="0 auto",
            padding="2rem",
        ),

    )





```

### meta_glasses/lib/python3.9/site-packages/pip/_internal/main.py

```python
from typing import List, Optional


def main(args=None):
    # type: (Optional[List[str]]) -> int
    """This is preserved for old console scripts that may still be referencing
    it.

    For additional details, see https://github.com/pypa/pip/issues/7498.
    """
    from pip._internal.utils.entrypoints import _wrapper

    return _wrapper(args)

```

### meta_glasses/lib/python3.9/site-packages/pip/_internal/models/index.py

```python
import urllib.parse


class PackageIndex:
    """Represents a Package Index and provides easier access to endpoints
    """

    __slots__ = ['url', 'netloc', 'simple_url', 'pypi_url',
                 'file_storage_domain']

    def __init__(self, url: str, file_storage_domain: str) -> None:
        super().__init__()
        self.url = url
        self.netloc = urllib.parse.urlsplit(url).netloc
        self.simple_url = self._url_for_path('simple')
        self.pypi_url = self._url_for_path('pypi')

        # This is part of a temporary hack used to block installs of PyPI
        # packages which depend on external urls only necessary until PyPI can
        # block such packages themselves
        self.file_storage_domain = file_storage_domain

    def _url_for_path(self, path: str) -> str:
        return urllib.parse.urljoin(self.url, path)


PyPI = PackageIndex(
    'https://pypi.org/', file_storage_domain='files.pythonhosted.org'
)
TestPyPI = PackageIndex(
    'https://test.pypi.org/', file_storage_domain='test-files.pythonhosted.org'
)

```

### meta_glasses/lib/python3.9/site-packages/pip/_internal/cli/main.py

```python
"""Primary application entrypoint.
"""
import locale
import logging
import os
import sys
from typing import List, Optional

from pip._internal.cli.autocompletion import autocomplete
from pip._internal.cli.main_parser import parse_command
from pip._internal.commands import create_command
from pip._internal.exceptions import PipError
from pip._internal.utils import deprecation

logger = logging.getLogger(__name__)


# Do not import and use main() directly! Using it directly is actively
# discouraged by pip's maintainers. The name, location and behavior of
# this function is subject to change, so calling it directly is not
# portable across different pip versions.

# In addition, running pip in-process is unsupported and unsafe. This is
# elaborated in detail at
# https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program.
# That document also provides suggestions that should work for nearly
# all users that are considering importing and using main() directly.

# However, we know that certain users will still want to invoke pip
# in-process. If you understand and accept the implications of using pip
# in an unsupported manner, the best approach is to use runpy to avoid
# depending on the exact location of this entry point.

# The following example shows how to use runpy to invoke pip in that
# case:
#
#     sys.argv = ["pip", your, args, here]
#     runpy.run_module("pip", run_name="__main__")
#
# Note that this will exit the process after running, unlike a direct
# call to main. As it is not safe to do any processing after calling
# main, this should not be an issue in practice.


def main(args: Optional[List[str]] = None) -> int:
    if args is None:
        args = sys.argv[1:]

    # Configure our deprecation warnings to be sent through loggers
    deprecation.install_warning_logger()

    autocomplete()

    try:
        cmd_name, cmd_args = parse_command(args)
    except PipError as exc:
        sys.stderr.write(f"ERROR: {exc}")
        sys.stderr.write(os.linesep)
        sys.exit(1)

    # Needed for locale.getpreferredencoding(False) to work
    # in pip._internal.utils.encoding.auto_decode
    try:
        locale.setlocale(locale.LC_ALL, "")
    except locale.Error as e:
        # setlocale can apparently crash if locale are uninitialized
        logger.debug("Ignoring error %s when setting locale", e)
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))

    return command.main(cmd_args)

```

### meta_glasses/lib/python3.9/site-packages/pip/_internal/commands/index.py

```python
import logging
from optparse import Values
from typing import Any, Iterable, List, Optional, Union

from pip._vendor.packaging.version import LegacyVersion, Version

from pip._internal.cli import cmdoptions
from pip._internal.cli.req_command import IndexGroupCommand
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.commands.search import print_dist_installation_info
from pip._internal.exceptions import CommandError, DistributionNotFound, PipError
from pip._internal.index.collector import LinkCollector
from pip._internal.index.package_finder import PackageFinder
from pip._internal.models.selection_prefs import SelectionPreferences
from pip._internal.models.target_python import TargetPython
from pip._internal.network.session import PipSession
from pip._internal.utils.misc import write_output

logger = logging.getLogger(__name__)


class IndexCommand(IndexGroupCommand):
    """
    Inspect information available from package indexes.
    """

    usage = """
        %prog versions <package>
    """

    def add_options(self) -> None:
        cmdoptions.add_target_python_options(self.cmd_opts)

        self.cmd_opts.add_option(cmdoptions.ignore_requires_python())
        self.cmd_opts.add_option(cmdoptions.pre())
        self.cmd_opts.add_option(cmdoptions.no_binary())
        self.cmd_opts.add_option(cmdoptions.only_binary())

        index_opts = cmdoptions.make_option_group(
            cmdoptions.index_group,
            self.parser,
        )

        self.parser.insert_option_group(0, index_opts)
        self.parser.insert_option_group(0, self.cmd_opts)

    def run(self, options: Values, args: List[Any]) -> int:
        handlers = {
            "versions": self.get_available_package_versions,
        }

        logger.warning(
            "pip index is currently an experimental command. "
            "It may be removed/changed in a future release "
            "without prior warning."
        )

        # Determine action
        if not args or args[0] not in handlers:
            logger.error(
                "Need an action (%s) to perform.",
                ", ".join(sorted(handlers)),
            )
            return ERROR

        action = args[0]

        # Error handling happens here, not in the action-handlers.
        try:
            handlers[action](options, args[1:])
        except PipError as e:
            logger.error(e.args[0])
            return ERROR

        return SUCCESS

    def _build_package_finder(
        self,
        options: Values,
        session: PipSession,
        target_python: Optional[TargetPython] = None,
        ignore_requires_python: Optional[bool] = None,
    ) -> PackageFinder:
        """
        Create a package finder appropriate to the index command.
        """
        link_collector = LinkCollector.create(session, options=options)

        # Pass allow_yanked=False to ignore yanked versions.
        selection_prefs = SelectionPreferences(
            allow_yanked=False,
            allow_all_prereleases=options.pre,
            ignore_requires_python=ignore_requires_python,
        )

        return PackageFinder.create(
            link_collector=link_collector,
            selection_prefs=selection_prefs,
            target_python=target_python,
        )

    def get_available_package_versions(self, options: Values, args: List[Any]) -> None:
        if len(args) != 1:
            raise CommandError('You need to specify exactly one argument')

        target_python = cmdoptions.make_target_python(options)
        query = args[0]

        with self._build_session(options) as session:
            finder = self._build_package_finder(
                options=options,
                session=session,
                target_python=target_python,
                ignore_requires_python=options.ignore_requires_python,
            )

            versions: Iterable[Union[LegacyVersion, Version]] = (
                candidate.version
                for candidate in finder.find_all_candidates(query)
            )

            if not options.pre:
                # Remove prereleases
                versions = (version for version in versions
                            if not version.is_prerelease)
            versions = set(versions)

            if not versions:
                raise DistributionNotFound(
                    'No matching distribution found for {}'.format(query))

            formatted_versions = [str(ver) for ver in sorted(
                versions, reverse=True)]
            latest = formatted_versions[0]

        write_output('{} ({})'.format(query, latest))
        write_output('Available versions: {}'.format(
            ', '.join(formatted_versions)))
        print_dist_installation_info(query, latest)

```

### meta_glasses/lib/python3.9/site-packages/pip/_vendor/distlib/index.py

```python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import hashlib
import logging
import os
import shutil
import subprocess
import tempfile
try:
    from threading import Thread
except ImportError:
    from dummy_threading import Thread

from . import DistlibException
from .compat import (HTTPBasicAuthHandler, Request, HTTPPasswordMgr,
                     urlparse, build_opener, string_types)
from .util import zip_dir, ServerProxy

logger = logging.getLogger(__name__)

DEFAULT_INDEX = 'https://pypi.org/pypi'
DEFAULT_REALM = 'pypi'

class PackageIndex(object):
    """
    This class represents a package index compatible with PyPI, the Python
    Package Index.
    """

    boundary = b'----------ThIs_Is_tHe_distlib_index_bouNdaRY_$'

    def __init__(self, url=None):
        """
        Initialise an instance.

        :param url: The URL of the index. If not specified, the URL for PyPI is
                    used.
        """
        self.url = url or DEFAULT_INDEX
        self.read_configuration()
        scheme, netloc, path, params, query, frag = urlparse(self.url)
        if params or query or frag or scheme not in ('http', 'https'):
            raise DistlibException('invalid repository: %s' % self.url)
        self.password_handler = None
        self.ssl_verifier = None
        self.gpg = None
        self.gpg_home = None
        with open(os.devnull, 'w') as sink:
            # Use gpg by default rather than gpg2, as gpg2 insists on
            # prompting for passwords
            for s in ('gpg', 'gpg2'):
                try:
                    rc = subprocess.check_call([s, '--version'], stdout=sink,
                                               stderr=sink)
                    if rc == 0:
                        self.gpg = s
                        break
                except OSError:
                    pass

    def _get_pypirc_command(self):
        """
        Get the distutils command for interacting with PyPI configurations.
        :return: the command.
        """
        from .util import _get_pypirc_command as cmd
        return cmd()

    def read_configuration(self):
        """
        Read the PyPI access configuration as supported by distutils. This populates
        ``username``, ``password``, ``realm`` and ``url`` attributes from the
        configuration.
        """
        from .util import _load_pypirc
        cfg = _load_pypirc(self)
        self.username = cfg.get('username')
        self.password = cfg.get('password')
        self.realm = cfg.get('realm', 'pypi')
        self.url = cfg.get('repository', self.url)

    def save_configuration(self):
        """
        Save the PyPI access configuration. You must have set ``username`` and
        ``password`` attributes before calling this method.
        """
        self.check_credentials()
        from .util import _store_pypirc
        _store_pypirc(self)

    def check_credentials(self):
        """
        Check that ``username`` and ``password`` have been set, and raise an
        exception if not.
        """
        if self.username is None or self.password is None:
            raise DistlibException('username and password must be set')
        pm = HTTPPasswordMgr()
        _, netloc, _, _, _, _ = urlparse(self.url)
        pm.add_password(self.realm, netloc, self.username, self.password)
        self.password_handler = HTTPBasicAuthHandler(pm)

    def register(self, metadata):
        """
        Register a distribution on PyPI, using the provided metadata.

        :param metadata: A :class:`Metadata` instance defining at least a name
                         and version number for the distribution to be
                         registered.
        :return: The HTTP response received from PyPI upon submission of the
                request.
        """
        self.check_credentials()
        metadata.validate()
        d = metadata.todict()
        d[':action'] = 'verify'
        request = self.encode_request(d.items(), [])
        response = self.send_request(request)
        d[':action'] = 'submit'
        request = self.encode_request(d.items(), [])
        return self.send_request(request)

    def _reader(self, name, stream, outbuf):
        """
        Thread runner for reading lines of from a subprocess into a buffer.

        :param name: The logical name of the stream (used for logging only).
        :param stream: The stream to read from. This will typically a pipe
                       connected to the output stream of a subprocess.
        :param outbuf: The list to append the read lines to.
        """
        while True:
            s = stream.readline()
            if not s:
                break
            s = s.decode('utf-8').rstrip()
            outbuf.append(s)
            logger.debug('%s: %s' % (name, s))
        stream.close()

    def get_sign_command(self, filename, signer, sign_password,
                         keystore=None):
        """
        Return a suitable command for signing a file.

        :param filename: The pathname to the file to be signed.
        :param signer: The identifier of the signer of the file.
        :param sign_password: The passphrase for the signer's
                              private key used for signing.
        :param keystore: The path to a directory which contains the keys
                         used in verification. If not specified, the
                         instance's ``gpg_home`` attribute is used instead.
        :return: The signing command as a list suitable to be
                 passed to :class:`subprocess.Popen`.
        """
        cmd = [self.gpg, '--status-fd', '2', '--no-tty']
        if keystore is None:
            key
[truncated — 15248 more characters]
```

### rxconfig.py

```python
import reflex as rx

config = rx.Config(
    app_name="calhacks",
)
```

### gemini_to_text.py

```python
from langchain_core.messages import HumanMessage
from langchain_google_genai import ChatGoogleGenerativeAI
import base64, httpx
from langchain_core.retrievers import BaseRetriever, RetrieverOutput
from langchain_core.runnables import Runnable, RunnablePassthrough
from PIL import Image
import base64
import io


import getpass
import os

from flask import Flask, request, jsonify
app = Flask(__name__)

@app.route('/gemini_endpoint', methods=['POST'])
def fn():

    data = request.get_json()
    name = data.get('name')
    age = data.get('age')
    print(f'Received name: {name}, age: {age}')

    base64_image = base64.b64decode(age)
    filename = "hotel_test.jpg"
    with open(filename, 'wb') as f:
        f.write(base64_image)
    
    if "GOOGLE_API_KEY" not in os.environ:
        os.environ["GOOGLE_API_KEY"] = "AIzaSyA9Ddx0pD-qN9rzbCVaMQ1eNAW5BeIXTqw"

    # Initialize the model
    model = ChatGoogleGenerativeAI(model="gemini-1.5-flash")

    def encode_image(image: Image.Image) -> str:
        buffered = io.BytesIO()
        image.save(buffered, format="JPEG")
        return base64.b64encode(buffered.getvalue()).decode("utf-8")

    image = Image.open('hotel_test.jpg')

    # Download and encode the image
    image_data = encode_image(image)

    # Create a message with the image

    message = HumanMessage(
        content=[
            {"type": "text", "text": "First describe the scene. Then, describe directions for how you would get from one side of the room to the other, and point out key obstacles. Specify the exact depth and distance between objects. Assume you were speaking to a blind person and helping them navigate."},
            {
                "type": "image_url",
                "image_url": {"url": f"data:image/jpeg;base64,{image_data}"},
            },
        ],
    )
    # Invoke the model with the message
    response = model.invoke([message])

    # Print the model's response
    print(response.content)
    return response.content

```

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