@@ -77,6 +77,9 @@ function isMarlinModel(model: ModelData): boolean {
7777function isTransformersModel ( model : ModelData ) : boolean {
7878 return model . tags . includes ( "transformers" ) ;
7979}
80+ function isTgiModel ( model : ModelData ) : boolean {
81+ return model . tags . includes ( "text-generation-inference" ) ;
82+ }
8083
8184function isLlamaCppGgufModel ( model : ModelData ) {
8285 return ! ! model . gguf ?. context_length ;
@@ -184,6 +187,34 @@ const snippetVllm = (model: ModelData): LocalAppSnippet[] => {
184187 } ,
185188 ] ;
186189} ;
190+ const snippetTgi = ( model : ModelData ) : LocalAppSnippet [ ] => {
191+ const runCommand = [
192+ "# Call the server using curl:" ,
193+ `curl -X POST "http://localhost:8000/v1/chat/completions" \\` ,
194+ ` -H "Content-Type: application/json" \\` ,
195+ ` --data '{` ,
196+ ` "model": "${ model . id } ",` ,
197+ ` "messages": [` ,
198+ ` {"role": "user", "content": "What is the capital of France?"}` ,
199+ ` ]` ,
200+ ` }'` ,
201+ ] ;
202+ return [
203+ {
204+ title : "Use Docker images" ,
205+ setup : [
206+ "# Deploy with docker on Linux:" ,
207+ `docker run --gpus all \\` ,
208+ ` -v ~/.cache/huggingface:/root/.cache/huggingface \\` ,
209+ ` -e HF_TOKEN="<secret>" \\` ,
210+ ` -p 8000:80 \\` ,
211+ ` ghcr.io/huggingface/text-generation-inference:latest \\` ,
212+ ` --model-id ${ model . id } ` ,
213+ ] . join ( "\n" ) ,
214+ content : [ runCommand . join ( "\n" ) ] ,
215+ } ,
216+ ] ;
217+ } ;
187218
188219/**
189220 * Add your new local app here.
@@ -218,6 +249,13 @@ export const LOCAL_APPS = {
218249 ( model . pipeline_tag === "text-generation" || model . pipeline_tag === "image-text-to-text" ) ,
219250 snippet : snippetVllm ,
220251 } ,
252+ tgi : {
253+ prettyLabel : "TGI" ,
254+ docsUrl : "https://huggingface.co/docs/text-generation-inference/" ,
255+ mainTask : "text-generation" ,
256+ displayOnModelPage : isTgiModel ,
257+ snippet : snippetTgi ,
258+ } ,
221259 lmstudio : {
222260 prettyLabel : "LM Studio" ,
223261 docsUrl : "https://lmstudio.ai" ,
0 commit comments