Skip to main content

Camera → Local LLM Inference App

Description

A Python desktop app that captures images or short video clips from a webcam, optionally crops them, and sends them in-memory (no external file needed to be saved previously) to a local LLM via LM Studio for conversational analysis.


Project Structure (Main Files)

Camera_LLM_Inference/
└── camera_llm/
       ├── __init__.py
       ├── camera_thread.py         # QThread for OpenCV camera capture
       ├── chat_session.py          # ChatSession dataclass + JSON serialisation
       ├── chat_store.py            # Read/write chat sessions to chats/*.json
       ├── cli.py                   # Entry point handling CLI and launching app (app initialization)
       ├── llm_client.py            # OpenAI client → LM Studio, in-memory encode
       ├── main_window.py           # Main window that aids navigation among the 7 screens
       ├── styles.py                # Global stylesheet + design tokens     
       └── screens/
           ├── __init__.py
           ├── screen1_home.py          # Dashboard + saved chats panel
           ├── screen2_capture.py       # Live camera feed, capture/record controls
           ├── screen3_crop.py          # Rubber-band crop with dimming overlay
           ├── screen4_model_select.py  # LM Studio URL + model dropdown
           ├── screen5_chat.py          # Chatbot with streaming, thumbnails, bubbles
           ├── screen6_save.py          # Name & save the session
           └── screen7_done.py          # Confirmation + auto-redirect home
└── chats/                           # Auto-created at runtime for saved sessions
├── pyproject.toml                   # Package metadata + entry points
├── requirements.txt                 # pip dependencies

How to Run

cd "c:\Users\kurei\Documents\Machine_Deep Learning\Camera_LLM_Inference"
pip install -e .
camera-llm run

Prerequisites

  1. Webcam connected or IP camera with reachable IP address (e.g. http://[IP_ADDRESS])
  2. LM Studio running with a vision model loaded (e.g. LLaVA, Qwen-VL)
  3. LM Studio local server started (default: http://localhost:1234)

Optional (download distribution zip file)

Alternatively, you can Download the Distribution Zip File to Run as Standalone Application. This saves you the time of downloading the repo and installing the other dependencies, but it also takes around 2.5 GB of disk space (in addition to less frequent updates). Once downloaded, unzip the file then navigate to "\CameraLLMInference\CameraLLMInference.exe" to run the application.


User Flow

graph TD;
    S1["Screen 1: Home"] -->|Image| S2I["Screen 2: Camera (Image)"];
    S1 -->|Video| S2V["Screen 2: Camera (Video)"];
    S2I -->|Capture| S3["Screen 3: Crop"];
    S2V -->|Stop recording| S3;
    S3 -->|Use Full / Apply Crop| S4["Screen 4: Model Select"];
    S4 -->|Analyse| S5["Screen 5: Chat"];
    S5 -->|Finish| S6["Screen 6: Save?"];
    S6 -->|Save / Skip| S7["Screen 7: Done"];
    S7 -->|3s auto| S1;
    S1 -->|Open saved chat| S5P["Screen 5: Chat (past chat)"];
    S5P -->|Continue Chatting| S5;

Change Camera Feed Guide

  1. If you are using a standard USB webcam, you can just type 0, 1, 2, etc. and hit Enter. It will connect as a regular USB camera.
  2. If you want to use a smartphone, download a free app like IP Webcam (Android) or similar apps for iOS that broadcast your camera over WiFi. Start the server to use as a WiFi camera
  3. Note the URL that will be set (ex: http://192.168.1.100:8080).
  4. Paste that exact URL into the 'Camera' text box and press Enter.

Key Design Decisions

Decision Choice Rationale
GUI framework PySide6 Robust threading (QThread), rich widget set, no licensing issues
Camera OpenCV in QThread Non-blocking — GUI stays responsive at 30 fps
In-memory encoding cv2.imencode → base64 No file ever touches disk; data goes straight to the LLM API
Video → LLM Sample up to 8 frames Local VLMs don't accept video — sending evenly-spaced frames approximates it
LLM API openai client → localhost:1234 LM Studio is OpenAI-compatible; swapping to a cloud provider later is trivial
Chat persistence JSON files in chats/ Simple, portable, human-readable

Features

  • 7 Screens (Home, Capture, Crop, Model Select, Chat, Save, Done)
  • Image and Video Capture (With Rotate Feed Capability)
  • LLM Chat with Streaming
  • Save/Load Chat Sessions (Chats are listed with the last modified date and time)
  • Model Selection (LLM URL + Model Dropdown)
  • Delete or Rename Saved Chats

[!CAUTION] Remember to load the same model that was used when first starting the chat (referenced in the title)

[!NOTE] The video input feature works by sending multiple frames from the video to the LLM in order to process as multiple images. The multiple frames (images) are sent as a panel (chained images) so the LLM can interpret it as one image (full context). This is done primarily due to employing a local LLM.

What Was Verified

  • ✅ All dependencies install cleanly
  • ✅ All module imports resolve without errors
  • ✅ App launches and renders Screen 1 correctly
  • ✅ Fixed pyqtdarktheme API for v0.1.7 (load_stylesheet instead of setup_theme)

Physical Testing Passed

  • 📷 Camera feed with a physical webcam
  • 🎬 Video recording and frame sampling
  • 🤖 End-to-end LLM chat (requires LM Studio with a vision model running)
  • 💾 Save/load chat sessions
  • 📱 Verify smartphone can be used as webcam (App used in Testing: IP Webcam for Android)

⏳ In Progress

  • More robust UI

[!IMPORTANT] Some dummy chats are present already under the Saved Chats section (chats/ folder). This was collected during testing and left to provide various samples. As such, they can be safely deleted.

Metadata

Release files for camera-llm 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for camera-llm 0.1.1
File Size Uploaded Provenance
camera_llm-0.1.1.tar.gz 33.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for camera-llm 0.1.1
File Interpreter ABI Platform
camera_llm-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 72.3 kB

Release files / camera_llm-0.1.1.tar.gz

Download URL camera_llm-0.1.1.tar.gz
Size 33.9 kB
Tags Source
SHA-256 checksum
How to use checksums
526fdf3aaec4c118f5db2b098459a87a8f4047a10343abbeef3f5f0c353ad032
BLAKE2b-256 checksum
How to use checksums
3c6111ae8b934ad089324a224e00aa7e54e79d2856860351fb7fc798bcd87f82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / camera_llm-0.1.1-py3-none-any.whl

Download URL camera_llm-0.1.1-py3-none-any.whl
Size 38.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb3e704a4fb8c871cedea7465bb9c51ee56fa5acb649547bbc645a9688b8e5b4
BLAKE2b-256 checksum
How to use checksums
1efe03956544055e8588319fb664241da1e0468e6bb59393bf3970705e7bb5bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Security for camera-llm 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page