Skip to content

Conversation

@patnir411
Copy link

@patnir411 patnir411 commented Jul 6, 2025

This is a work in progress, the current commit stands as a working MVP. I'm looking for absolutely any feedback in polishing this for the repository if it'd be a valuable feature to add. Made with the help of Gemini CLI :)

This commit introduces a new "Toggle Server" feature that runs a local HTTP server on the device. This allows developers and researchers to interact with the on-device AI models using curl, with all communication tunneled exclusively over a USB connection.

The server can handle multipart/form-data requests, allowing users to send a prompt, an image, or both. This provides a powerful new way to test, debug, and integrate the on-device models.

Usage

  1. Enable USB Debugging:

    • Follow these steps to enable USB debugging on your device.
  2. Connect Device to Computer & Enable Port Forwarding:

    adb -d forward tcp:8080 tcp:8080
  3. Start the Server in the App:

    • Navigate to the "Toggle Server" screen.
    • Tap the "Start In-App Server" button.
  4. Send Requests with curl:

    • Prompt only:
      curl -X POST -F "prompt=Hello, world!" http://localhost:8080
    • Image and prompt:
      curl -X POST -F "prompt=What is in this image?" -F "image=@/path/to/your/image.jpg" http://localhost:8080

This commit introduces a new "Toggle Server" feature that runs a local HTTP server on the device. This allows developers and researchers to interact with the on-device AI models using `curl`, with all communication tunneled exclusively over the USB cable.

The server can handle multipart/form-data requests, allowing users to send a prompt, an image, or both. This provides a powerful new way to test, debug, and integrate the on-device models.
@n1203
Copy link

n1203 commented Aug 6, 2025

This is really much needed 👍

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