Installation

Requirements

To develop a visionOS app, you would need:

  • A Mac with Apple silicon chip

  • Xcode 15.0+

  • The visionOS Simulator

Install Xcode and visionOS Simulator

  1. To install Xcode, open App Store on your Mac and search for "Xcode". Then, click on the "Get" button to download it.

  2. Once Xcode is installed, launch Xcode and a dialog will appear to show which simulator runtime you may install. Select "visionOS" with the most current version and click the "Download & Install" button.

    Xcode and visionOS Simulator Installation

Install visionOS App: Discover

  1. Open the "Terminal" on your Mac and navigate to a directory where you want the visionOS app to be.

  2. Clone the Repository:

    git clone https://github.com/Apple-Vision-Pro-UA-CS495/apple-vision-pro-main.git
    

Install the Dependency in the visionOS App

  1. Add the Lottie Library to the app

Run the visionOS app

  1. Start the AWS EC2 Instance

    Start the AWS EC2 Instance GIFs
  2. Start the server

    • For Windows, run this command in the terminal:

      ssh -i {path_to_pem_file}\aws_pem.pem ec2-user@{IP_address}
      cd app
      uvicorn server:app --host 0.0.0.0 --port 8000
      
    • For Mac, run this command in the terminal:

      ssh -i {path_to_pem_file}/aws_pem.pem ec2-user@{IP_address}
      cd app
      uvicorn server:app --host 0.0.0.0 --port 8000
      
      Start the server GIF
  3. Start visionOS app

    • Open "Discover.xcodeproj" in Xcode

      Discover.xcodeproj file
    • Make sure the OpenAI API Key is in the Scheme. If it is not, then add the API Key

      Add the OpenAI Key
    • Select visionOS simulator as the target device

    • Press Cmd + R or click the Run button in Xcode to build and run

      Start the visionOS app GIF
  4. When you are done, make sure to stop the server and stop the EC2 instance to save money

Backend Setup Guide

This section provides a guide for when you want to create a new EC2 Instance and get it up and running.

Local Setup

  1. Create Python virtual environment

  2. Install dependencies

  3. Use this command to run the server:

    uvicorn server:app --host 0.0.0.0 --port 8000 --reload
    
  4. Run the client.py file to test

EC2 Setup

  1. Create an EC2 instance in AWS

    • Recommend using t2.xlarge due to dependency size

    • Set a static IP address

    • Allow inbound traffic to ports 8000, 22, and 443

  2. Start EC2 instance in AWS

  3. In terminal run:

    • For Windows:

      ssh -i {path_to_pem_file}\aws_pem.pem ec2-user@{IP_address}
      
    • For Mac:

      ssh -i {path_to_pem_file}/aws_pem.pem ec2-user@{IP_address}
      
  4. Download server.py file and requirements.txt from our data processing repo (If you have any issues with these files, fallback to requirements2.txt and server2.py)

  5. Move these files from local into EC2 using SCP:

    scp -i {path_to_pem_file}\aws_pem.pem {path_to_file}\file ec2-user@{IP_address}
    
  6. Install dependencies in EC2 using pip:

    pip install -r requirements.txt
    
  7. Run:

    uvicorn server:app --host 0.0.0.0 --port 8000
    
  8. Hit server with this link: ws://{IP address}:8000/ws

  9. When you are done, make sure to stop the server and stop the EC2 instance to save money

  10. For future use, you can just spin up the EC2 instance, ssh in, and run the uvicorn command to start the server again

  11. Run tests in EC2: move test.py into EC2 (tests not meant to be run with server2.py)

    • Then run:

      pytest test.py