-
Notifications
You must be signed in to change notification settings - Fork 396
Local apps #659
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
Local apps #659
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
10eb2d7
document gguf and tasks in the main README + better order for tasks/R…
julien-c 5de31b8
is that what you meant?
julien-c 9ea6fa8
time to remove this
julien-c b76cf3e
`model.tags` is actually non-optional i think
julien-c e9df990
Create local-apps.ts
julien-c 4585a4f
`model.tags` is actually non-optional i think
julien-c 5089d14
Update packages/tasks/README.md
julien-c dd6b986
Update packages/tasks/README.md
julien-c cc11f28
Update packages/tasks/src/local-apps.ts
julien-c 2dc1ad5
feat: re-export local apps
krampstudio 51c4f37
fixup: format
krampstudio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import type { ModelData } from "./model-data"; | ||
import type { PipelineType } from "./pipelines"; | ||
|
||
/** | ||
* Elements configurable by a local app. | ||
*/ | ||
export type LocalApp = { | ||
/** | ||
* Name that appears in buttons | ||
*/ | ||
prettyLabel: string; | ||
/** | ||
* Link to get more info about a local app (website etc) | ||
*/ | ||
docsUrl: string; | ||
/** | ||
* main category of app | ||
*/ | ||
mainTask: PipelineType; | ||
julien-c marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/** | ||
* Whether to display a pill "macOS-only" | ||
*/ | ||
macOSOnly?: boolean; | ||
|
||
comingSoon?: boolean; | ||
/** | ||
* IMPORTANT: function to figure out whether to display the button on a model page's main "Use this model" dropdown. | ||
*/ | ||
displayOnModelPage: (model: ModelData) => boolean; | ||
} & ( | ||
| { | ||
/** | ||
* If the app supports deeplink, URL to open. | ||
*/ | ||
deeplink: (model: ModelData) => URL; | ||
} | ||
| { | ||
/** | ||
* And if not (mostly llama.cpp), snippet to copy/paste in your terminal | ||
*/ | ||
snippet: (model: ModelData) => string; | ||
} | ||
); | ||
|
||
function isGgufModel(model: ModelData) { | ||
return model.tags.includes("gguf"); | ||
} | ||
|
||
const snippetLlamacpp = (model: ModelData): string => { | ||
return `./main \ | ||
--hf-repo ${model.id} \ | ||
-m file.gguf \ | ||
julien-c marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-p "I believe the meaning of life is " -n 128`; | ||
}; | ||
|
||
/** | ||
* Add your new local app here. | ||
* | ||
* This is open to new suggestions and awesome upcoming apps. | ||
* | ||
* /!\ IMPORTANT | ||
* | ||
* If possible, you need to support deeplinks and be as cross-platform as possible. | ||
* | ||
* Ping the HF team if we can help with anything! | ||
*/ | ||
export const LOCAL_APPS = { | ||
"llama.cpp": { | ||
prettyLabel: "llama.cpp", | ||
docsUrl: "https://github.com/ggerganov/llama.cpp", | ||
mainTask: "text-generation", | ||
displayOnModelPage: isGgufModel, | ||
snippet: snippetLlamacpp, | ||
}, | ||
lmstudio: { | ||
prettyLabel: "LM Studio", | ||
docsUrl: "https://lmstudio.ai", | ||
mainTask: "text-generation", | ||
displayOnModelPage: isGgufModel, | ||
deeplink: (model) => new URL(`lmstudio://open_from_hf?model=${model.id}`), | ||
}, | ||
jan: { | ||
prettyLabel: "Jan", | ||
docsUrl: "https://jan.ai", | ||
mainTask: "text-generation", | ||
displayOnModelPage: isGgufModel, | ||
julien-c marked this conversation as resolved.
Show resolved
Hide resolved
|
||
deeplink: (model) => new URL(`jan://open_from_hf?model=${model.id}`), | ||
}, | ||
faraday: { | ||
prettyLabel: "Faraday", | ||
docsUrl: "https://faraday.dev", | ||
mainTask: "text-generation", | ||
macOSOnly: true, | ||
displayOnModelPage: isGgufModel, | ||
deeplink: (model) => new URL(`faraday://open_from_hf?model=${model.id}`), | ||
}, | ||
drawthings: { | ||
prettyLabel: "Draw Things", | ||
docsUrl: "https://drawthings.ai", | ||
mainTask: "text-to-image", | ||
macOSOnly: true, | ||
/** | ||
* random function, will need to refine the actual conditions: | ||
*/ | ||
displayOnModelPage: (model) => model.tags.includes("textual_inversion"), | ||
deeplink: (model) => new URL(`drawthings://open_from_hf?model=${model.id}`), | ||
}, | ||
diffusionbee: { | ||
prettyLabel: "DiffusionBee", | ||
docsUrl: "https://diffusionbee.com", | ||
mainTask: "text-to-image", | ||
macOSOnly: true, | ||
comingSoon: true, | ||
displayOnModelPage: (model) => model.library_name === "diffusers" && model.pipeline_tag === "text-to-image", | ||
julien-c marked this conversation as resolved.
Show resolved
Hide resolved
|
||
deeplink: (model) => new URL(`diffusionbee://open_from_hf?model=${model.id}`), | ||
}, | ||
} satisfies Record<string, LocalApp>; | ||
|
||
export type LocalAppKey = keyof typeof LOCAL_APPS; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.