Skip to content

Commit

Permalink
Community tools (huggingface#1250)
Browse files Browse the repository at this point in the history
* wip community tools

* push

* fix

* bugfix

* pass inputs to gradio correctly

* full inputs for imagegen

* lint

* update gradio

* fix call to gradio

* fix imagegen tool

* fix name

* fix image display

* Community tools (huggingface#1297)

* work on tools

* wip

* icon

* page

* use IDs for every tools

* improve tools page

* wip

* add optimized deps

* refacto 1tool=1function

* Add preview page

* fix active indicator

* fix text alignment

* fix populate script

* tooledit

* fixes

* better inputs

* fix console error & cancel button

* upload new tools

* edit

* improve lint

* working community tools

* fix active featured check

* Simplify outputs in user form

* fix non file outputs

* fix imagegen default tool

* add community tools popup

* redirect gradio API calls through chat-ui backend

* better usecount

* Better loading & output element

* better redirects & auto activate

* bugfixes

* fix migration changes

* Add feature flag for tools

* fix tools menu

* Keep track of output component index

* fix null check

* catch error for spaces config

* wip: MIME types

* wip: rework tools to use filenames

* fix broken tool calling

* fix input tools

* Working files

* fix(form): bind on name

* fix(prompt): double system prompt

* fix(prompt): file list

* fix(tools): make sure tools are off by default

* Add description to ToolEdit

* Display runs

* feat(tools): add back document parser

* feat(tools): bring back image editing tool

* fix MIME types

* Fix file passing prompts

* fix lint

* Set tools to default in migration

* Revert "Set tools to default in migration"

This reverts commit 87fdd09.

* Use correct space for official image generation

* Remove debug logs

* fix(redirect): working redirect when no `APP_BASE`

* sveltekit 2 migration

* fix types with gradio update

* fix name based searching

* fix cut titles

* add min & max

* add error if no endpoint

* make form not submittable until it's filled

* fix return

* Better support for varied input types

* fix(update): hide null values for params that have not been called explicitly by the model

* add extra migration for transition

* fix document parser mime types
  • Loading branch information
nsarrazin authored Aug 12, 2024
1 parent 7eac22f commit e6862f8
Show file tree
Hide file tree
Showing 61 changed files with 3,381 additions and 4,341 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ ALLOW_INSECURE_COOKIES=false # recommended to keep this to false but set to true
METRICS_ENABLED=false
METRICS_PORT=5565
LOG_LEVEL=info


TOOLS=`[]`
BODY_SIZE_LIMIT=15728640

HF_ORG_ADMIN=
Expand Down
145 changes: 145 additions & 0 deletions chart/env/prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,151 @@ envVars:
}]
WEBSEARCH_BLOCKLIST: '["youtube.com", "twitter.com"]'
XFF_DEPTH: '2'
TOOLS: >
[
{
"_id": "000000000000000000000001",
"displayName": "Image Generation",
"description": "Use this tool to generate images based on a prompt.",
"color": "yellow",
"icon": "camera",
"baseUrl": "stabilityai/stable-diffusion-3-medium",
"name": "image_generation",
"endpoint": "/infer",
"inputs": [
{
"name": "prompt",
"description": "A prompt to generate an image from",
"paramType": "required",
"type": "str"
},
{
"name": "negative_prompt",
"description": "A prompt for things that should not be in the image.",
"paramType": "optional",
"default": "",
"type": "str"
},
{
"name": "seed",
"paramType": "fixed",
"value": "0",
"type": "float"
},
{
"name": "randomize_seed",
"paramType": "fixed",
"value": "true",
"type": "bool"
},
{
"name": "width",
"description": "numeric value between 256 and 1344",
"paramType": "optional",
"default": 1024,
"type": "float"
},
{
"name": "height",
"description": "numeric value between 256 and 1344",
"paramType": "optional",
"default": 1024,
"type": "float"
},
{
"name": "guidance_scale",
"description": "numeric value between 0.0 and 10.0",
"paramType": "optional",
"default": 5,
"type": "float"
},
{
"name": "num_inference_steps",
"description": "numeric value between 1 and 50",
"paramType": "optional",
"default": 28,
"type": "float"
}
],
"outputComponent": "image",
"outputComponentIdx": 0,
"showOutput": true
},
{
"_id": "000000000000000000000002",
"displayName": "Document parser",
"description": "Use this tool to parse any document and get its content in markdown format.",
"color": "yellow",
"icon": "cloud",
"baseUrl": "huggingchat/document-parser",
"name": "document_parser",
"endpoint": "/predict",
"inputs": [
{
"name": "document",
"description": "Filename of the document to parse",
"paramType": "required",
"type": "file",
"mimeTypes": 'application/*'
},
{
"name": "filename",
"paramType": "fixed",
"value": "document.pdf",
"type": "str"
}
],
"outputComponent": "textbox",
"outputComponentIdx": 0,
"showOutput": false
},
{
"_id": "000000000000000000000003",
"name": "edit_image",
"baseUrl": "multimodalart/cosxl",
"endpoint": "/run_edit",
"inputs": [
{
"name": "image",
"description": "The image path to be edited",
"paramType": "required",
"type": "file",
"mimeTypes": 'image/*'
},
{
"name": "prompt",
"description": "The prompt with which to edit the image",
"paramType": "required",
"type": "str"
},
{
"name": "negative_prompt",
"paramType": "fixed",
"value": "",
"type": "str"
},
{
"name": "guidance_scale",
"paramType": "fixed",
"value": 6.5,
"type": "float"
},
{
"name": "steps",
"paramType": "fixed",
"value": 30,
"type": "float"
}
],
"outputComponent": "image",
"showOutput": true,
"displayName": "Image editor",
"color": "green",
"icon": "camera",
"description": "This tool lets you edit images",
"outputComponentIdx": 0
}
]
HF_ORG_ADMIN: 'huggingchat'
HF_ORG_EARLY_ACCESS: 'huggingface'

Expand Down
Loading

0 comments on commit e6862f8

Please sign in to comment.