Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

35 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ONAI โ€” AI Vision Assistant

See. Understand. Remember.

An AI-powered multimodal assistant that combines computer vision, conversational AI, memory retrieval, and voice interaction to help users understand the world around them.


๐Ÿ“Œ Overview

ONAI is a personal AI vision assistant designed to interact with the physical world through a camera.

Traditional AI image-analysis applications generally follow a simple pattern:

Image โ†’ AI โ†’ Response

ONAI aims to go further:

Camera
   โ†“
Current Visual Context
   โ†“
Conversation
   โ†“
Memory Retrieval
   โ†“
Adaptive Prompt Construction
   โ†“
Multimodal AI
   โ†“
Context-Aware Response
   โ†“
Memory
   โ†“
Future Interactions

Instead of treating every image as an isolated request, ONAI is designed to maintain an understanding of the user's ongoing interaction.

For example, a user could point the camera at a phone, ask what it is, move the camera toward a book, and then ask a follow-up question. ONAI should be able to understand that the visual context has changed rather than blindly relying on an older frame.

The long-term goal is to create an assistant that can see, reason, remember, and interact naturally with its environment.


โœจ Core Features

๐Ÿ“ท Real-Time Vision

ONAI uses the device camera as its primary interface with the physical environment.

The camera system allows the user to:

  • Capture visual information.
  • Send frames to the AI backend.
  • Analyze objects and scenes.
  • Ask questions about what is currently visible.
  • Continue conversations while the visual environment changes.

The system is designed around fresh visual context rather than relying permanently on previously captured images.


๐Ÿง  Multimodal AI

ONAI uses Google's Gemini multimodal models to process both:

  • Natural-language prompts
  • Visual information

This allows questions such as:

"What am I looking at?"
"What's written on this page?"
"What is this object used for?"
"Can you explain what I'm seeing?"
"Is there anything unusual about this?"

The AI response is generated using the combination of the user's request and the available visual context.


๐Ÿ’ฌ Conversational Interaction

ONAI isn't designed to behave like a one-shot image classifier.

The user can maintain a conversation with the assistant.

Example:

User:
"What is this?"

ONAI:
"That's a mechanical keyboard."

User:
"How does it work?"

ONAI:
"It uses individual switches beneath each key..."

User:
"Would it be good for programming?"

ONAI:
"Yes. Mechanical keyboards are popular for programming because..."

The conversation provides additional context that can be used when constructing subsequent AI requests.


๐Ÿง  Vision Memory System

One of ONAI's most important features is its vision memory system.

A normal vision assistant might forget everything after generating a response.

ONAI instead stores structured information about previous interactions.

A simplified memory entry can contain:

{
    prompt,
    frame,
    response,
    timestamp
}

This allows ONAI to retrieve previous interactions when they are relevant to the current conversation.

Memory Pipeline

Current Interaction
       โ†“
Generate Response
       โ†“
Create Memory
       โ†“
Store Interaction
       โ†“
Future User Request
       โ†“
Search Previous Memories
       โ†“
Retrieve Relevant Context
       โ†“
Add Context to Prompt
       โ†“
Generate Response

This provides the foundation for a more persistent AI assistant.


๐Ÿ”Ž Memory Search & Retrieval

Simply storing thousands of previous interactions isn't enough.

ONAI needs to determine which memories are relevant.

The memory system therefore separates:

Memory Storage

Stores previous interactions and their associated visual/contextual information.

Memory Retrieval

Searches previous interactions for information that could help answer the current request.

Context Injection

Relevant memories are then incorporated into the prompt sent to the AI model.

This creates a pipeline similar to:

User Request
      โ†“
Memory Search
      โ†“
Relevant Memories
      โ†“
Current Camera Frame
      โ†“
Conversation History
      โ†“
Adaptive Prompt
      โ†“
Gemini
      โ†“
Response

๐ŸŽฏ Adaptive Prompt Builder

ONAI doesn't rely on one static prompt for every interaction.

The prompt can be dynamically constructed based on available context.

Potential context includes:

  • Current user question
  • Current camera frame
  • Previous conversation
  • Relevant memories
  • Previous visual context
  • Current interaction state

Conceptually:

Base Instructions
       +
Current Question
       +
Current Visual Context
       +
Conversation Context
       +
Retrieved Memories
       โ†“
Adaptive Prompt
       โ†“
Gemini

This allows the AI to receive only the context that is relevant to the current interaction.


๐Ÿ‘๏ธ Context Awareness

One of the challenges with vision assistants is stale visual context.

For example:

1. Camera sees a phone.
2. ONAI identifies the phone.
3. User moves the camera.
4. Camera now sees a book.
5. User asks about the book.

A poorly designed system may continue talking about the phone because an old frame remains in memory.

ONAI addresses this by distinguishing between:

Current Visual Context

What the camera is seeing right now.

Historical Context

What ONAI saw during previous interactions.

This distinction allows memory to provide useful historical information without overriding the current visual state.


๐Ÿ“ Scan Guide

ONAI includes a visual scan guide to help users focus the camera on a particular region.

Conceptually:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                             โ”‚
โ”‚        CAMERA VIEW          โ”‚
โ”‚                             โ”‚
โ”‚       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”‚
โ”‚       โ”‚           โ”‚         โ”‚
โ”‚       โ”‚   SCAN    โ”‚         โ”‚
โ”‚       โ”‚   AREA    โ”‚         โ”‚
โ”‚       โ”‚           โ”‚         โ”‚
โ”‚       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚
โ”‚                             โ”‚
โ”‚                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

The guide is an interface feature rather than a restriction on the camera itself.

The camera can still provide the full image to the backend while the interface helps the user visually target the object or area they want ONAI to understand.


๐ŸŽ™๏ธ Voice Interaction

ONAI is being designed for interaction that doesn't require constant typing.

Voice functionality allows users to interact with the assistant through spoken commands.

A typical interaction can become:

User speaks
     โ†“
Voice Input
     โ†“
Text / Command
     โ†“
Vision + Memory
     โ†“
AI Response
     โ†“
Text-to-Speech
     โ†“
User hears response

This makes ONAI more suitable for situations where the user's hands are occupied.


๐Ÿ™Œ Hands-Free Mode

ONAI also explores a more natural hands-free interaction model.

Instead of requiring the user to:

Open camera
โ†’ Take image
โ†’ Type question
โ†’ Wait
โ†’ Repeat

the long-term interaction model is closer to:

Look
 โ†“
Ask
 โ†“
ONAI understands
 โ†“
Responds
 โ†“
Continue

This is particularly important for the long-term goal of making ONAI feel like an assistant rather than an image-analysis tool.


๐Ÿ—๏ธ System Architecture

ONAI is divided into several major components.

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚       USER          โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚
                               โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚      FRONTEND       โ”‚
                    โ”‚                     โ”‚
                    โ”‚ React + TypeScript  โ”‚
                    โ”‚ Camera Interface    โ”‚
                    โ”‚ Chat Interface      โ”‚
                    โ”‚ Voice Interface     โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚
                               โ”‚ HTTP
                               โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚      FASTAPI        โ”‚
                    โ”‚      BACKEND        โ”‚
                    โ”‚                     โ”‚
                    โ”‚ API Routes          โ”‚
                    โ”‚ Request Handling    โ”‚
                    โ”‚ AI Integration      โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚
                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ”‚                         โ”‚
                  โ–ผ                         โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚   GEMINI AI     โ”‚       โ”‚  MEMORY SYSTEM   โ”‚
        โ”‚                 โ”‚       โ”‚                  โ”‚
        โ”‚ Vision          โ”‚       โ”‚ Storage          โ”‚
        โ”‚ Reasoning       โ”‚       โ”‚ Retrieval        โ”‚
        โ”‚ Generation      โ”‚       โ”‚ Context          โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚                         โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  CONTEXT-AWARE      โ”‚
                    โ”‚     RESPONSE        โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงฉ Frontend Architecture

The frontend is built with React and TypeScript.

Major components include:

CameraPanel
ChatPanel
Navbar

CameraPanel

Responsible for:

  • Camera access
  • Capturing frames
  • Displaying the live camera
  • Scan guide UI
  • Connecting camera state with the vision system

ChatPanel

Responsible for:

  • User messages
  • AI responses
  • Conversation display
  • Loading states
  • Error states
  • Interaction with the chat system

Vision Context

The application maintains shared vision state so that components can access the current visual frame without tightly coupling the camera component to the rest of the application.


โš™๏ธ Backend Architecture

The backend uses FastAPI.

The backend provides API endpoints for communication between the frontend and the AI system.

A simplified request flow:

Frontend
   โ”‚
   โ”‚ POST /analyze
   โ–ผ
FastAPI
   โ”‚
   โ”œโ”€โ”€ Validate request
   โ”‚
   โ”œโ”€โ”€ Process image
   โ”‚
   โ”œโ”€โ”€ Build AI context
   โ”‚
   โ”œโ”€โ”€ Retrieve memory
   โ”‚
   โ””โ”€โ”€ Call Gemini
            โ”‚
            โ–ผ
        AI Response
            โ”‚
            โ–ผ
        FastAPI
            โ”‚
            โ–ผ
        Frontend

๐Ÿ”Œ API

The backend currently exposes core endpoints such as:

GET /

Basic API/root endpoint.

GET /health

Health-check endpoint used to determine whether the backend is running.

POST /analyze

Main vision-analysis endpoint.

Conceptually:

POST /analyze

Input:
    image
    prompt

Processing:
    image โ†’ Gemini Vision

Output:
    AI-generated analysis

๐Ÿ› ๏ธ Technology Stack

Frontend

Technology Purpose
React UI framework
TypeScript Type safety
Vite Development/build tooling
Tailwind CSS Styling
React Router Application routing
Axios HTTP communication
React Webcam Camera integration
Lucide React UI icons

Backend

Technology Purpose
Python Backend language
FastAPI API framework
Google GenAI SDK Gemini integration
Gemini Multimodal AI

Mobile

Technology Purpose
React Native Mobile UI
Expo Mobile development platform
TypeScript Type safety

๐Ÿ“ Project Structure

The project is organized around separate frontend, backend, and mobile applications.

ONAI/
โ”‚
โ”œโ”€โ”€ frontend/
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ CameraPanel/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ChatPanel/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Navbar/
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ contexts/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ VisionContext/
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ useChat/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ useMemory/
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ analyzeImage/
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ””โ”€โ”€ pages/
โ”‚   โ”‚       โ””โ”€โ”€ Home/
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ backend/
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ””โ”€โ”€ gemini_service.py
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ””โ”€โ”€ requirements.txt
โ”‚
โ”œโ”€โ”€ mobile/
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ assets/
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ ...

The project structure may change as development continues.


๐Ÿš€ Getting Started

Prerequisites

Before running ONAI, make sure you have:

  • Python 3.10+
  • Node.js
  • npm
  • Git
  • A Google Gemini API key
  • A webcam/camera for vision functionality

For mobile development:

  • Expo
  • Android Studio and/or an Android device
  • Or an iOS development environment

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/ONAI.git

cd ONAI

2. Backend Setup

Create a Python virtual environment:

python -m venv venv

Windows:

venv\Scripts\activate

macOS/Linux:

source venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Create a .env file:

GEMINI_API_KEY=your_api_key_here

Start the backend:

uvicorn main:app --reload

The API should then be available at:

http://localhost:8000

FastAPI documentation is available at:

http://localhost:8000/docs

3. Frontend Setup

Navigate to the frontend:

cd frontend

Install dependencies:

npm install

Start the development server:

npm run dev

The frontend should be available at:

http://localhost:5173

4. Mobile Setup

Navigate to the mobile project:

cd mobile

Install dependencies:

npm install

Start Expo:

npx expo start

You can then run the application using:

  • Android emulator
  • iOS simulator
  • Physical Android device
  • Physical iPhone

๐Ÿ” Environment Variables

API keys should never be committed to the repository.

Example:

GEMINI_API_KEY=your_gemini_api_key

Make sure your environment file is ignored:

.env
.env.local

A production deployment should use a secure secret-management system rather than exposing API credentials to the frontend.


๐Ÿงช Development Philosophy

ONAI is being developed incrementally using development sprints.

Each sprint focuses on a specific capability rather than attempting to build the entire system at once.

The development process has included:

Core Vision
     โ†“
Camera Integration
     โ†“
Conversational Interface
     โ†“
Vision Context
     โ†“
Scan Interface
     โ†“
Memory
     โ†“
Memory Retrieval
     โ†“
Adaptive Prompts
     โ†“
Context Awareness
     โ†“
Voice / Hands-Free Interaction
     โ†“
Mobile Application
     โ†“
Future Multimodal Capabilities

This approach makes it possible to test each major subsystem independently before combining them.


๐Ÿ—บ๏ธ Development Roadmap

โœ… Completed

  • Initial project architecture
  • React frontend
  • FastAPI backend
  • Gemini integration
  • Camera integration
  • Image analysis
  • Conversational chat
  • Vision context
  • Camera scan guide
  • Vision memory
  • Memory search
  • Memory retrieval
  • Adaptive prompt builder
  • Context awareness
  • Voice interaction
  • Hands-free interaction

๐Ÿšง In Progress

  • React Native mobile application
  • Mobile camera integration
  • Mobile voice interaction
  • Cross-platform synchronization
  • Improved memory architecture
  • Improved real-time performance

๐Ÿ”ฎ Future

  • Real-time object tracking
  • AI-generated visual annotations
  • Live object identification
  • OCR improvements
  • Scene understanding
  • Persistent long-term memory
  • User personalization
  • Offline/edge AI experimentation
  • Wearable-device integration
  • Smart-glasses compatibility
  • Continuous environmental understanding

๐Ÿงช Example Interaction

Imagine the user is sitting at a desk.

Step 1 โ€” Camera

ONAI sees:

Laptop
Notebook
Phone
Coffee cup

Step 2 โ€” User

"What objects are on my desk?"

Step 3 โ€” Vision Model

Gemini analyzes the current frame.

Step 4 โ€” ONAI

The response might be:

"I can see a laptop, a notebook, a phone,
and a coffee cup on your desk."

Step 5 โ€” Follow-up

The user moves the camera toward the notebook:

"What is this used for?"

ONAI should prioritize the current notebook frame, while still using previous conversation context where appropriate.

This distinction between current perception and historical memory is fundamental to the design of ONAI.


๐Ÿง  Why ONAI?

The project explores an important question:

What happens when an AI assistant can continuously perceive and remember the environment around its user?

Most AI assistants primarily interact through text or isolated images.

ONAI experiments with a different model:

Language
   +
Vision
   +
Memory
   +
Voice
   +
Context
   =
Personal Multimodal Assistant

The goal isn't simply to make another chatbot.

The goal is to build an AI system that can develop an understanding of an ongoing interaction with the physical world.


๐ŸŽฏ Long-Term Vision

The long-term vision for ONAI is a personal AI assistant that can accompany the user throughout their day.

A future version could potentially:

See an environment
      โ†“
Understand objects
      โ†“
Understand the user's request
      โ†“
Remember relevant history
      โ†“
Reason about the situation
      โ†“
Respond through voice
      โ†“
Continue observing

This could eventually enable applications such as:

  • Accessibility assistance
  • Educational assistance
  • Object and scene explanation
  • Reading and document assistance
  • Navigation assistance
  • Personal productivity
  • Hands-free computing
  • Real-world AI tutoring
  • Wearable AI interfaces

๐Ÿ“Š Project Status

Current Stage: Active Development

Latest Major Milestone: Sprint 12 โ€” Smarter Vision Memory, Memory Search & Retrieval, Adaptive Prompt Builder & Context Awareness

Current Focus: Mobile application development and expanding ONAI into a cross-platform multimodal assistant.


๐Ÿค Contributing

ONAI is currently a personal development project, but feedback, ideas, and technical discussion are welcome.

To contribute:

git clone https://github.com/YOUR_USERNAME/ONAI.git

Create a feature branch:

git checkout -b feature/your-feature

Make your changes, test them, commit them, and open a pull request.


๐Ÿ“„ License

ONAI is currently under active development.

License information will be added as the project reaches a stable release.


๐Ÿ‘จโ€๐Ÿ’ป Author

Omar Nashiru-Deen

Software Engineering Student AI / Software Engineering Enthusiast

ONAI is an ongoing exploration into multimodal AI, computer vision, conversational systems, memory architectures, and human-computer interaction.


ONAI
See. Understand. Remember.

About

ONAI - AI-powered real-time visual assistant built with React, FastAPI, and Google Gemini.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages