8000 Update to add multi-modal by rhatdan · Pull Request #1522 · containers/ramalama · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update to add multi-modal #1522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025
Merged

Update to add multi-modal #1522

merged 1 commit into from
Jun 13, 2025

Conversation

rhatdan
Copy link
Member
@rhatdan rhatdan commented Jun 13, 2025

Remove failing on pipe errors, since something the network can fail and break the demo, it would be better to continue after failures.

Summary by Sourcery

Introduce a new multi-modal camera-based demo in the RamaLama demo suite and relax error handling to prevent demo interruptions.

New Features:

  • Add a multi-modal() function in the demo script to serve the smolvlm model, open the camera interaction page, and manage the demo container.
  • Include camera-demo.html to enable live webcam capture, send images with text instructions to the model service, and display responses in a web interface.

Enhancements:

  • Comment out strict set -eou pipefail in the demo script to allow the demo to continue after pipe errors.

Documentation:

  • Add a user-facing HTML demo with controls for instruction input, response display, and adjustable request intervals.

Remove failing on pipe errors, since something the network
can fail and break the demo,  it would be better to continue
after failures.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Copy link
Contributor
sourcery-ai bot commented Jun 13, 2025

Reviewer's Guide

This PR enhances the demo by relaxing strict pipe error handling and embedding a new multi-modal demonstration: it defines a Bash step to serve a vision-capable model, launches a camera-driven web app for image+instruction interaction, and cleans up after the run.

Sequence Diagram for Multi-modal Demo Script Execution

sequenceDiagram
    actor User
    participant Script as "ramalama.sh (multi-modal function)"
    participant ModelService as "ramalama serve smolvlm"
    participant Browser as "Web Browser (camera-demo.html)"
    participant StopService as "ramalama stop multi-modal"

    User->>Script: Executes multi-modal function
    Script->>ModelService: Starts smolvlm service (ramalama serve)
    Script->>Browser: Opens camera-demo.html (google-chrome)
    Note over Browser, User: User interacts with web app
    Script->>User: Waits for 'clear' prompt
    User->>Script: Presses Enter
    Script->>StopService: Stops smolvlm service (ramalama stop)
Loading

Sequence Diagram for Camera Demo Web App Interaction

sequenceDiagram
    actor User
    participant WebApp as "camera-demo.html (Browser)"
    participant BrowserAPI as "Browser Camera API"
    participant RamaLamaService as "RamaLama API (/v1/chat/completions)"

    WebApp->>BrowserAPI: initCamera(): navigator.mediaDevices.getUserMedia()
    BrowserAPI-->>WebApp: Camera stream
    User->>WebApp: Enters instruction
    User->>WebApp: Clicks "Start"
    WebApp->>WebApp: handleStart()
    loop Image capture and processing interval
        WebApp->>WebApp: sendData()
        WebApp->>BrowserAPI: captureImage() from video stream
        BrowserAPI-->>WebApp: Image (Base64)
        WebApp->>RamaLamaService: POST {instruction, image}
        RamaLamaService-->>WebApp: {response text}
        WebApp->>User: Displays response
    end
    User->>WebApp: Clicks "Stop"
    WebApp->>WebApp: handleStop()
    WebApp->>User: Updates UI (e.g., "Processing stopped")
Loading

File-Level Changes

Change Details Files
Relax error-fail settings in the demo script
  • Comment out ‘set -eou pipefail’ to prevent abort on pipe errors
docs/demo/ramalama.sh
Add multi-modal demonstration steps in the shell script
  • Define ‘multi-modal’ function to serve the model, launch browser, stop container, and clear
  • Invoke ‘multi-modal’ at the end of the demo sequence
docs/demo/ramalama.sh
Introduce a camera-based HTML/JS demo for multi-modal interaction
  • Add new ‘camera-demo.html’ with styled UI for video feed, instruction and response areas
  • Implement JS to init camera, capture frames, and send image+text payloads to the model API
  • Handle start/stop controls, interval timing, error reporting, and resource cleanup
docs/demo/camera-demo.html

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@rhatdan
Copy link
Member Author
rhatdan commented Jun 13, 2025

Replaces #1412

Copy link
Contributor
@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @rhatdan - I've reviewed your changes - here's some feedback:

  • Commenting out set -eou pipefail disables strict error handling for the entire demo script—consider scoping error catches around the network calls instead of turning off strict mode globally.
  • In the HTML demo, the <input id="baseURL"> tag is incorrectly closed with </textarea>, breaking the DOM structure—use a proper self-closing <input> tag.
  • The JS sendData function can fire overlapping requests if one takes longer than the interval—add a per-call in-flight guard or clear the interval until the promise resolves to prevent races.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Commenting out `set -eou pipefail` disables strict error handling for the entire demo script—consider scoping error catches around the network calls instead of turning off strict mode globally.
- In the HTML demo, the `<input id="baseURL">` tag is incorrectly closed with `</textarea>`, breaking the DOM structure—use a proper self-closing `<input>` tag.
- The JS `sendData` function can fire overlapping requests if one takes longer than the interval—add a per-call in-flight guard or clear the interval until the promise resolves to prevent races.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ericcurtin ericcurtin merged commit 6556b04 into containers:main Jun 13, 2025
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0