modelscope-gradio-components


Namemodelscope-gradio-components JSON
Version 0.0.1b10 PyPI version JSON
download
home_page
SummaryA set of extension component, inluding components for conversational input and display in multimodal scenarios, as well as more components for vertical scenarios.
upload_time2024-02-04 06:20:40
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords gradio-custom-component gradio-template-chatbot modelscope-gradio-components
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1>Modelscope Gradio Components</h1>

<p align="center">
    <img src="https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif" height="60" style="vertical-align: middle;"/>
    <span style="font-size: 30px; vertical-align: middle;">
    ✖️
    </span>
    <img src="https://www.gradio.app/_app/immutable/assets/gradio.8a5e8876.svg" height="60" style="vertical-align: middle;">
<p>

<p align="center">
🤖 <a href="https://modelscope.cn/studios/modelscope/modelscope_gradio_components/summary">Modelscope Studio</a> | 🤗 <a href="https://huggingface.co/spaces/modelscope/modelscope_gradio_components">HuggingFace Space</a>
<br>
  <a href="README-zh_CN.md">中文</a>&nbsp | &nbspEnglish
</p>

ModelScope_Gradio_Components is a set of extension component libraries based on gradio 4.x, dedicated to serving the various extension needs of gradio applications within the ModelScope Studio. It mainly focuses on enhancing conversational scenarios, supporting multimodal contexts, and providing assistance for various other specialized scenarios.

## Install

```sh
pip install modelscope_gradio_components
```

## Quickstart

```python
import time
import gradio as gr
import modelscope_gradio_components as mgr

def submit(_input, _chatbot):
    print('text:', _input.text)
    print('files: ', _input.files)
    _chatbot.append([_input, None])
    yield _chatbot
    time.sleep(1)
    _chatbot[-1][1] = [{
        "flushing": False,
        "text": 'bot1: ' + _input.text + '!'
    }, {
        "text": 'bot2: ' + _input.text + '!'
    }]
    yield {
        chatbot: _chatbot,
    }

with gr.Blocks() as demo:
    chatbot = mgr.Chatbot(height=400)

    input = mgr.MultimodalInput()
    input.submit(fn=submit, inputs=[input, chatbot], outputs=[chatbot])

demo.queue().launch()
```

![quickstart](./resources/quickstart.png)

## Component Docs

The currently supported components include:

- Chatbot: gradio Chatbot extension component, supports multi-modal content output, multi-bot scenarios, and custom rendering components and event interactions within the conversation content.
- MultimodalInput: A multi-modal input box, supporting functions such as file upload, recording, and photography.
- Markdown: gradio Markdown extension component, supports the output of multi-modal content (audio, video, voice, files, text).
- ImageGallery (WIP): gradio Gallery extension component, supports waterfall-style image display.
- More components are being updated...

For detailed usage, see [Documentation and Examples](https://modelscope.cn/studios/modelscope/modelscope_gradio_components/summary)

## Development

Clone this repo locally:

```sh
git clone git@github.com:modelscope/modelscope-gradio-components.git
cd modelscope-gradio-components
# for backend
pip install -e '.'
# for frontend
npm install pnpm -g

pnpm install
pnpm build
```

Run demo!

```sh
gradio docs/app.py
```

or run a single demo like this:

```sh
gradio docs/components/Chatbot/demos/basic.py
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "modelscope-gradio-components",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "gradio-custom-component,gradio-template-Chatbot,modelscope-gradio-components",
    "author": "",
    "author_email": "YOUR NAME <YOUREMAIL@domain.com>",
    "download_url": "https://files.pythonhosted.org/packages/ca/52/af8829f5e4a23ce1d1948340c94b40a5c5e918628c51ff706c5bf36cbc8f/modelscope_gradio_components-0.0.1b10.tar.gz",
    "platform": null,
    "description": "<h1>Modelscope Gradio Components</h1>\n\n<p align=\"center\">\n    <img src=\"https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif\" height=\"60\" style=\"vertical-align: middle;\"/>\n    <span style=\"font-size: 30px; vertical-align: middle;\">\n    \u2716\ufe0f\n    </span>\n    <img src=\"https://www.gradio.app/_app/immutable/assets/gradio.8a5e8876.svg\" height=\"60\" style=\"vertical-align: middle;\">\n<p>\n\n<p align=\"center\">\n\ud83e\udd16 <a href=\"https://modelscope.cn/studios/modelscope/modelscope_gradio_components/summary\">Modelscope Studio</a> \uff5c \ud83e\udd17 <a href=\"https://huggingface.co/spaces/modelscope/modelscope_gradio_components\">HuggingFace Space</a>\n<br>\n  <a href=\"README-zh_CN.md\">\u4e2d\u6587</a>&nbsp \uff5c &nbspEnglish\n</p>\n\nModelScope_Gradio_Components is a set of extension component libraries based on gradio 4.x, dedicated to serving the various extension needs of gradio applications within the ModelScope Studio. It mainly focuses on enhancing conversational scenarios, supporting multimodal contexts, and providing assistance for various other specialized scenarios.\n\n## Install\n\n```sh\npip install modelscope_gradio_components\n```\n\n## Quickstart\n\n```python\nimport time\nimport gradio as gr\nimport modelscope_gradio_components as mgr\n\ndef submit(_input, _chatbot):\n    print('text\uff1a', _input.text)\n    print('files: ', _input.files)\n    _chatbot.append([_input, None])\n    yield _chatbot\n    time.sleep(1)\n    _chatbot[-1][1] = [{\n        \"flushing\": False,\n        \"text\": 'bot1: ' + _input.text + '!'\n    }, {\n        \"text\": 'bot2: ' + _input.text + '!'\n    }]\n    yield {\n        chatbot: _chatbot,\n    }\n\nwith gr.Blocks() as demo:\n    chatbot = mgr.Chatbot(height=400)\n\n    input = mgr.MultimodalInput()\n    input.submit(fn=submit, inputs=[input, chatbot], outputs=[chatbot])\n\ndemo.queue().launch()\n```\n\n![quickstart](./resources/quickstart.png)\n\n## Component Docs\n\nThe currently supported components include:\n\n- Chatbot: gradio Chatbot extension component, supports multi-modal content output, multi-bot scenarios, and custom rendering components and event interactions within the conversation content.\n- MultimodalInput: A multi-modal input box, supporting functions such as file upload, recording, and photography.\n- Markdown: gradio Markdown extension component, supports the output of multi-modal content (audio, video, voice, files, text).\n- ImageGallery (WIP): gradio Gallery extension component, supports waterfall-style image display.\n- More components are being updated...\n\nFor detailed usage, see [Documentation and Examples](https://modelscope.cn/studios/modelscope/modelscope_gradio_components/summary)\n\n## Development\n\nClone this repo locally:\n\n```sh\ngit clone git@github.com:modelscope/modelscope-gradio-components.git\ncd modelscope-gradio-components\n# for backend\npip install -e '.'\n# for frontend\nnpm install pnpm -g\n\npnpm install\npnpm build\n```\n\nRun demo!\n\n```sh\ngradio docs/app.py\n```\n\nor run a single demo like this:\n\n```sh\ngradio docs/components/Chatbot/demos/basic.py\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A set of extension component, inluding components for conversational input and display in multimodal scenarios, as well as more components for vertical scenarios.",
    "version": "0.0.1b10",
    "project_urls": null,
    "split_keywords": [
        "gradio-custom-component",
        "gradio-template-chatbot",
        "modelscope-gradio-components"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d7d8053948cb29a785baa36c093c419d33e68717014eb1ccc25e243741d4f98",
                "md5": "5163abf1921e58b889ae38eda85b6696",
                "sha256": "e7ae68494c6819afcf5521eafccb14aa95cb13d65b293a523e149811a14af576"
            },
            "downloads": -1,
            "filename": "modelscope_gradio_components-0.0.1b10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5163abf1921e58b889ae38eda85b6696",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6130352,
            "upload_time": "2024-02-04T06:20:34",
            "upload_time_iso_8601": "2024-02-04T06:20:34.320845Z",
            "url": "https://files.pythonhosted.org/packages/5d/7d/8053948cb29a785baa36c093c419d33e68717014eb1ccc25e243741d4f98/modelscope_gradio_components-0.0.1b10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ca52af8829f5e4a23ce1d1948340c94b40a5c5e918628c51ff706c5bf36cbc8f",
                "md5": "4ffd935cdb3304648bb99d1ae79d39b0",
                "sha256": "ea68a5f97c3351724996d27bfa708ebaa4b5d31a485a45ad2d2b67e4320c6ac6"
            },
            "downloads": -1,
            "filename": "modelscope_gradio_components-0.0.1b10.tar.gz",
            "has_sig": false,
            "md5_digest": "4ffd935cdb3304648bb99d1ae79d39b0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6086210,
            "upload_time": "2024-02-04T06:20:40",
            "upload_time_iso_8601": "2024-02-04T06:20:40.844431Z",
            "url": "https://files.pythonhosted.org/packages/ca/52/af8829f5e4a23ce1d1948340c94b40a5c5e918628c51ff706c5bf36cbc8f/modelscope_gradio_components-0.0.1b10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-04 06:20:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "modelscope-gradio-components"
}
        
Elapsed time: 2.26215s