Skip to content

Commit fd1d98a

Browse files
mudlerVaibhavs10enzostvs
authored
Add LocalAI to local-apps (#833)
Hello 👋 This PR adds LocalAI (https://localai.io) to the huggingface local-apps. It natively supports models directly from huggingface in gguf format by running localai e.g. with `huggingface://repo-id/file` ( docs: https://localai.io/docs/getting-started/models/#run-models-via-uri ) . It also supports transformers - however it needs a configuration file and can't be natively used, so piggybacking only to gguf files for now. --------- Signed-off-by: mudler <mudler@localai.io> Co-authored-by: Vaibhav Srivastav <vaibhavs10@gmail.com> Co-authored-by: enzo <eesteves@hotmail.fr>
1 parent 3a8651f commit fd1d98a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

packages/tasks/src/local-apps.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,29 @@ const snippetLlamacpp = (model: ModelData, filepath?: string): LocalAppSnippet[]
9999
];
100100
};
101101

102+
const snippetLocalAI = (model: ModelData, filepath?: string): LocalAppSnippet[] => {
103+
const command = (binary: string) =>
104+
["# Load and run the model:", `${binary} huggingface://${model.id}/${filepath ?? "{{GGUF_FILE}}"}`].join("\n");
105+
return [
106+
{
107+
title: "Install from binary",
108+
setup: "curl https://localai.io/install.sh | sh",
109+
content: command("local-ai run"),
110+
},
111+
{
112+
title: "Use Docker images",
113+
setup: [
114+
// prettier-ignore
115+
"# Pull the image:",
116+
"docker pull localai/localai:latest-cpu",
117+
].join("\n"),
118+
content: command(
119+
"docker run -p 8080:8080 --name localai -v $PWD/models:/build/models localai/localai:latest-cpu"
120+
),
121+
},
122+
];
123+
};
124+
102125
/**
103126
* Add your new local app here.
104127
*
@@ -126,6 +149,13 @@ export const LOCAL_APPS = {
126149
deeplink: (model, filepath) =>
127150
new URL(`lmstudio://open_from_hf?model=${model.id}${filepath ? `&file=${filepath}` : ""}`),
128151
},
152+
localai: {
153+
prettyLabel: "LocalAI",
154+
docsUrl: "https://github.com/mudler/LocalAI",
155+
mainTask: "text-generation",
156+
displayOnModelPage: isGgufModel,
157+
snippet: snippetLocalAI,
158+
},
129159
jan: {
130160
prettyLabel: "Jan",
131161
docsUrl: "https://jan.ai",

0 commit comments

Comments
 (0)