Skip to content
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

feat: llava #45

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c7456fb
feat: added everything
TimPietrusky Feb 4, 2024
fdbe8af
feat: improved stuff
TimPietrusky Feb 6, 2024
0cb7497
feat: exact requirements, how to setup the local env for development
TimPietrusky Feb 6, 2024
1c5f648
docs: use version 3.10.11 instead of 3.10.9
TimPietrusky Feb 6, 2024
83c34d3
fix: performance leaks
pixelass Feb 6, 2024
876ad1e
feat: sending properties to python, cleaned up code
TimPietrusky Feb 9, 2024
6db3517
chore: added "live-canvas-generate-image-output.png.tmp.png"
TimPietrusky Feb 9, 2024
bc5fde9
feat: added wd14, removed everything else, added unit test with jest,…
TimPietrusky Feb 10, 2024
16d723d
feat: added LLaVA
TimPietrusky Feb 13, 2024
ba637d1
feat: removed output extractors for tags, just provide the output. Re…
TimPietrusky Feb 14, 2024
bb44a2c
Merge remote-tracking branch 'origin/main' into feat/live-painting
pixelass Feb 14, 2024
6eea4c5
Merge remote-tracking branch 'origin/main' into feat/live-painting
pixelass Feb 14, 2024
e32fcc6
feat: add translations
pixelass Feb 15, 2024
4581c5f
chore: add json sorter
pixelass Feb 15, 2024
4393b21
feat: add live-painting demo
pixelass Feb 16, 2024
fa21c35
feat: add basic llava mechanism
pixelass Feb 17, 2024
76494d0
ci: added "semantic-release" to create automated "alpha" releases
TimPietrusky Feb 17, 2024
ce6c891
chore(release): 1.0.0-alpha.1
semantic-release-bot Feb 17, 2024
4b61299
feat: add git clone capability
pixelass Feb 18, 2024
e0297ad
Merge remote-tracking branch 'origin/main' into feat/llava
pixelass Feb 18, 2024
746c302
feat: handle download state
pixelass Feb 18, 2024
d8f5309
feat: disable live-painting
pixelass Feb 18, 2024
ad65b44
feat: add missing translations
pixelass Feb 18, 2024
a255ce5
fix: adjust various glitches
pixelass Feb 19, 2024
a072ea2
fix: adjust ps1 script
pixelass Feb 19, 2024
eec5db6
Merge remote-tracking branch 'origin/alpha' into feat/llava
pixelass Feb 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release - Windows

on:
workflow_dispatch:
push:
branches:
- "alpha"

jobs:
release:
runs-on: windows-latest-l
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }}
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- name: Install dependencies
run: npm install

- name: Fix auto-fixable eslint issues
run: npm run eslint -- --fix

- name: Update the ToC in the README.md
run: npx markdown-toc README.md -i

- name: Semantic release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ build

# python
resources/python-embedded/
resources/python-embeded/
resources/python/caption/wd14/models/model.onnx
resources/git/
__pycache__
.pytest_cache

# live-canvas
live-canvas-frontend-user-data.png
live-canvas-generate-image-output.png
live-canvas-generate-image-output.png.tmp.png
live-canvas-*.png

# tests
coverage
53 changes: 53 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"branches": [
"main",
{
"name": "alpha",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "npm run build && node ./scripts/update-readme.mjs ${nextRelease.version}"

}
],
[
"@semantic-release/git",
{
"assets": [
"README.md",
"CHANGELOG.md",
"package.json"
],
"message": "chore(release): ${nextRelease.version} \n\n${nextRelease.notes}"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "dist/Captain-Setup*.exe"
}
]
}
]
]
}
35 changes: 32 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# 1.0.0-alpha.1 (2024-02-17)


### Bug Fixes

* add all resources ([e75b3cd](https://github.com/blib-la/captain/commit/e75b3cdbeec5a06013434fcc38a8d84abdf365f0))
* downloads not possible ([#38](https://github.com/blib-la/captain/issues/38)) ([9f0dc48](https://github.com/blib-la/captain/commit/9f0dc482d77b697ffafe34f67ab22578a2fde242))
* gpt progress logic is broken ([#29](https://github.com/blib-la/captain/issues/29)) ([8bb04a5](https://github.com/blib-la/captain/commit/8bb04a510725bc8fc62c4714556e6ef353a9f096))
* icon color triggered by wrong button ([d3e069a](https://github.com/blib-la/captain/commit/d3e069a6418a10bff9366bf3b4fe4217cd9f7913))
* image data is undefined ([#28](https://github.com/blib-la/captain/issues/28)) ([b5d3ee4](https://github.com/blib-la/captain/commit/b5d3ee44442db9fd3dd00b1c119e1312b8fddecf))
* inital load has unlocalized UI ([#17](https://github.com/blib-la/captain/issues/17)) ([060df23](https://github.com/blib-la/captain/commit/060df231dcf345ef7f0f7f60115e932405c12483))
* lottie views are broken ([1ba6fd7](https://github.com/blib-la/captain/commit/1ba6fd776fdf3aa66655b3b0b0c3d67b98cbe2ad))
* popups logic ([d7e902b](https://github.com/blib-la/captain/commit/d7e902b04423452c797621343a574e3a4350eb00))
* progress count on gpt is wrong ([#27](https://github.com/blib-la/captain/issues/27)) ([25bacbc](https://github.com/blib-la/captain/commit/25bacbce8994bf6b7a3f227fd955bcc435c05e16)), closes [#26](https://github.com/blib-la/captain/issues/26)
* settings icon in light mode low contrast ([c967010](https://github.com/blib-la/captain/commit/c967010e2653e789137a31c2e6f4494a8590f4a7))
* tooltip on projects was overlaying ([c63f308](https://github.com/blib-la/captain/commit/c63f3089258f409a7f355e29f70997d1e412043a))


### Features

* add basic marketplace logic ([#20](https://github.com/blib-la/captain/issues/20)) ([727d5a7](https://github.com/blib-la/captain/commit/727d5a7b61d5def0f889b0f626d94c96db1b96cd))
* add context menu ([#41](https://github.com/blib-la/captain/issues/41)) ([bb030dd](https://github.com/blib-la/captain/commit/bb030ddffd8c3f29f2cc168d384729449502c59e))
* adjust colors of icons ([55bea04](https://github.com/blib-la/captain/commit/55bea04fe05887868161f7d5bbbc11bf38e9effd))
* allow deleting projects ([32740f4](https://github.com/blib-la/captain/commit/32740f4f6c862c760c52b6541351cdc9ffd7a884))
* complete rewrite of the ui ([9b2d52e](https://github.com/blib-la/captain/commit/9b2d52eb6858afc84b82374cd977ee2043ddeaf1))
* i18n support for export ([7e6c7f7](https://github.com/blib-la/captain/commit/7e6c7f75952131fb152e228facfb90c8f4fa85fa))
* implement captioning tools, blip, wd14, gpt-v ([614b4d4](https://github.com/blib-la/captain/commit/614b4d41abafe15ac4df312adf2ebd4afa0daade))
* new app icon ([#15](https://github.com/blib-la/captain/issues/15)) ([8e6df09](https://github.com/blib-la/captain/commit/8e6df0984af7c1418a9497fcee09bc8358a470d6))
* new user flow and implement editing ([2e5184d](https://github.com/blib-la/captain/commit/2e5184da05c2a3674fd9edabe392f1beb9276bfc))
* save info to user data ([c69d6a7](https://github.com/blib-la/captain/commit/c69d6a77c7e75d275f369d6745a3136ac27d495f))
* various improvements ([d02910e](https://github.com/blib-la/captain/commit/d02910e54175ad45f7da3319821fd8206c2c57fd))

# [1.0.0-beta.9](https://github.com/blib-la/captain/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2024-02-16)


Expand Down Expand Up @@ -70,6 +102,3 @@
* new user flow and implement editing ([2e5184d](https://github.com/blib-la/captain/commit/2e5184da05c2a3674fd9edabe392f1beb9276bfc))
* save info to user data ([c69d6a7](https://github.com/blib-la/captain/commit/c69d6a77c7e75d275f369d6745a3136ac27d495f))
* various improvements ([d02910e](https://github.com/blib-la/captain/commit/d02910e54175ad45f7da3319821fd8206c2c57fd))



65 changes: 41 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# Captain: Your Local AI Hub (currently in BETA)

Captain simplifies AI on your desktop. It's a free, open-source application that requires no complex setup — just a single .exe file. It provides a variety of AI tools and features a multi-language UI.
Captain simplifies AI on your desktop. It's a free, open-source application that requires no complex
setup — just a single .exe file. It provides a variety of AI tools and features a multi-language UI.

[![Discord](https://img.shields.io/discord/1091306623819059300?color=7289da&label=Discord&logo=discord&logoColor=fff&style=for-the-badge)](https://discord.com/invite/m3TBB9XEkb)

Captain currently supports English, German, Spanish, French, Italian, Japanese, Dutch, Polish, Portuguese, Russian, and Chinese.

Captain currently supports English, German, Spanish, French, Italian, Japanese, Dutch, Polish,
Portuguese, Russian, and Chinese.

<p align="center">
<img src="./docs/logo.png" alt="Download Captain" width="300">
</p>

<!-- releases -->
<p align="center">
<a href="https://github.com/blib-la/captain/releases/download/v1.0.0-beta.9/Captain.Setup.1.0.0-beta.9.exe">
<a href="https://github.com/blib-la/captain/releases/download/v1.0.0-alpha.1/Captain-Setup-1.0.0-alpha.1.exe">

Check notice on line 17 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L17

Element: a
<img src="./docs/download.svg" alt="Download Captain" width="300">
</a>
</p>
<!-- releasesstop -->

## Coming soon: Live Painting with AI, on your Computer

Expand All @@ -25,11 +28,9 @@

https://github.com/blib-la/captain/assets/1148334/e9f9419e-f6d7-4f35-96a7-667c18b799e2


<!-- toc -->

- [Key Features](#key-features)
- [Planned Features](#planned-features)
- [Getting Started](#getting-started)
* [Installation](#installation)
* [Detailed User Guide](#detailed-user-guide)
Expand All @@ -43,12 +44,18 @@

## Key Features

- **Versatile AI Tool Integration**: Seamlessly connect with various AI tools and models for diverse functionalities.
- **Local and Online Modes**: Operate fully offline after initial model downloads or connect with online AI services like OpenAI's GPT and RunPod.
- **Self-Contained Application**: Enjoy the simplicity of a single `.exe` file with no need for installing Python dependencies or other software.
- **Open Source and Free**: Accessible AI for everyone, with the full source code available for modification and extension.
- **Dynamic AI Model Marketplace**: Easily download and update Stable Diffusion checkpoints, LoRAs or other models directly through the in-app marketplace.
- **Image Captioning** : Start with state-of-the-art automatic captioning powered by multiple AI methods.
- **Versatile AI Tool Integration**: Seamlessly connect with various AI tools and models for

Check notice on line 47 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L47

Expected: 1; Actual: 3
diverse functionalities.
- **Local and Online Modes**: Operate fully offline after initial model downloads or connect with

Check notice on line 49 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L49

Expected: 1; Actual: 3
online AI services like OpenAI's GPT and RunPod.
- **Self-Contained Application**: Enjoy the simplicity of a single `.exe` file with no need for

Check notice on line 51 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L51

Expected: 1; Actual: 3
installing Python dependencies or other software.
- **Open Source and Free**: Accessible AI for everyone, with the full source code available for

Check notice on line 53 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L53

Expected: 1; Actual: 3
modification and extension.
- **Dynamic AI Model Marketplace**: Easily download and update Stable Diffusion checkpoints, LoRAs

Check notice on line 55 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L55

Expected: 1; Actual: 3
or other models directly through the in-app marketplace.
- **Image Captioning** : Start with state-of-the-art automatic captioning powered by multiple AI

Check notice on line 57 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L57

Expected: 1; Actual: 3
methods.

## Getting Started

Expand All @@ -60,46 +67,56 @@

### Detailed User Guide

For a comprehensive walkthrough of Captain's captioning feature and detailed instructions on how to make the most of Captain, please refer to our dedicated User Guide.
For a comprehensive walkthrough of Captain's captioning feature and detailed instructions on how to
make the most of Captain, please refer to our dedicated User Guide.

[Read the Full Guide](./docs/GUIDE.md)

This guide will assist you in navigating the captioning capabilities of Captain, ensuring you can leverage the power of local AI with confidence and ease.
This guide will assist you in navigating the captioning capabilities of Captain, ensuring you can
leverage the power of local AI with confidence and ease.

## Important Note: Installation Warning for Unsigned App

As Captain is currently an unsigned application, you may encounter a warning during the installation process. This is a standard notification for unsigned apps and does not indicate any security issue with Captain. Since Captain is open source, you can review the source code to ensure its safety.
As Captain is currently an unsigned application, you may encounter a warning during the installation
process. This is a standard notification for unsigned apps and does not indicate any security issue
with Captain. Since Captain is open source, you can review the source code to ensure its safety.

If you receive a warning, please follow these steps to proceed with the installation:

1. **Windows Users**:
- When the warning appears, click on "More info".
- You'll then see the option to "Run anyway". Click it to proceed with the installation.

- When the warning appears, click on "More info".

Check notice on line 88 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L88

Expected: 1; Actual: 3
- You'll then see the option to "Run anyway". Click it to proceed with the installation.

Check notice on line 89 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L89

Expected: 1; Actual: 3

2. **Mac Users** (if applicable in the future):
- Right-click (or Ctrl-click) the downloaded file and select "Open".
- In the warning dialog that appears, click "Open" to proceed.

Rest assured, the integrity and security of Captain are paramount to us. If you have any concerns or questions, please feel free to review our source code or contact us directly.
- Right-click (or Ctrl-click) the downloaded file and select "Open".

Check notice on line 93 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L93

Expected: 1; Actual: 3
- In the warning dialog that appears, click "Open" to proceed.

Check notice on line 94 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L94

Expected: 1; Actual: 3

Enjoy the powerful capabilities of Captain, and thank you for your trust and support!
Rest assured, the integrity and security of Captain are paramount to us. If you have any concerns or
questions, please feel free to review our source code or contact us directly.

Enjoy the powerful capabilities of Captain, and thank you for your trust and support!

## Community and Support

Encounter an issue or have suggestions? Head to our [issue tracker](https://github.com/blib-la/captain/issues) or engage with the community. Your feedback helps Captain sail smoothly!
Encounter an issue or have suggestions? Head to our
[issue tracker](https://github.com/blib-la/captain/issues) or engage with the community. Your
feedback helps Captain sail smoothly!

## Contribute to Captain

Join us on deck! If you're looking to contribute, our [Contribution Guidelines](./.github/CONTRIBUTING.md) will help you get started.
Join us on deck! If you're looking to contribute, our
[Contribution Guidelines](./.github/CONTRIBUTING.md) will help you get started.

## License

Captain is proudly open source, available under the [AGPL 3.0 License](./LICENSE).

## Acknowledgments

Hats off to our contributors, community, and everyone who supports Captain. Together, we're navigating the exciting waters of AI.
Hats off to our contributors, community, and everyone who supports Captain. Together, we're
navigating the exciting waters of AI.

---

Expand Down
11 changes: 7 additions & 4 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ directories:
files:
- from: .
filter:
- package.json
- app
- resources/python/**/*
- resources/powershell/**/*
- "package.json"
- "app"
- "resources/python/**/*"
- "resources/powershell/**/*"
- "resources/git/**/*"
publish: null
nsis:
oneClick: false
allowToChangeInstallationDirectory: true
artifactName: "${productName}-Setup-${version}.${ext}"
asar: true
asarUnpack:
- "resources/python/**/*"
- "resources/powershell/**/*"
- "resources/git/**/*"
35 changes: 35 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { defaults } from "jest-config";

const jestConfig = {
...defaults,
testMatch: ["**/?(*.)test.ts?(x)"],
testPathIgnorePatterns: [".e2e."],
transform: {
"^.+\\.(t|j)sx?$": [
"@swc/jest",
{
jsc: {
transform: {
react: {
runtime: "automatic",
},
},
},
},
],
},
collectCoverage: true,
coverageDirectory: "./coverage",
coverageProvider: "v8",
coverageReporters: ["lcov", "text", "json"],
coverageThreshold: {
global: {
lines: 80,
},
},
testEnvironment: "jsdom",
transformIgnorePatterns: ["/node_modules/"],
extensionsToTreatAsEsm: [".ts", ".tsx"],
};

export default jestConfig;
6 changes: 3 additions & 3 deletions main/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { isProduction, protocolName } from "./helpers/utils";
import { init } from "./init";
import { getInstalledVersion } from "./utils/first-launch";
import "./live-painting";
import "./datasets";

import "./captions";
import "./datasets/ipc";
import "./captions/ipc";
import "./git/ipc";

contextMenu({
showSaveImageAs: true,
Expand Down
31 changes: 31 additions & 0 deletions main/captions/__tests__/resize.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { resizeImageKeepingAspectRatio } from "../resize";

describe("resizeImageKeepingAspectRatio", () => {
it("should return original dimensions for images within the max area limit", () => {
const originalHeight = 800;
const originalWidth = 600;
const maxArea = 1024 * 1024; // 1,048,576
const result = resizeImageKeepingAspectRatio(originalHeight, originalWidth, maxArea);
expect(result).toEqual({ height: originalHeight, width: originalWidth });
});

it("should resize an image that exceeds the max area limit to fit within it, maintaining aspect ratio", () => {
const originalHeight = 3072;
const originalWidth = 1280;
const maxArea = 1024 * 1024; // 1,048,576
const result = resizeImageKeepingAspectRatio(originalHeight, originalWidth, maxArea);
expect(result.height * result.width).toBeLessThanOrEqual(maxArea);
expect(result.height).toBeGreaterThanOrEqual(1536);
expect(result.width).toBeGreaterThanOrEqual(640);
});

it("should handle zero and negative inputs gracefully", () => {
const height = 0;
const width = -200;
const maxArea = 1024 * 1024;
const result = resizeImageKeepingAspectRatio(height, width, maxArea);
// Depending on your function's implementation, adjust the expected result
// Here we assume it returns the input as is, but you might have error handling instead
expect(result).toEqual({ height: 0, width: -200 });
});
});
Loading