Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Modelscope Gradio Components

✖️

🤖 Modelscope Studio | 🤗 HuggingFace Space
中文  |  English

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

pip install modelscope_gradio_components

Quickstart

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

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

Development

Clone this repo locally:

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!

gradio docs/app.py

or run a single demo like this:

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

Release files for modelscope-gradio-components 0.0.1b10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modelscope-gradio-components 0.0.1b10
File Size Uploaded
modelscope_gradio_components-0.0.1b10.tar.gz 6.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for modelscope-gradio-components 0.0.1b10
File Interpreter ABI Platform
modelscope_gradio_components-0.0.1b10-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 MB

Release files / modelscope_gradio_components-0.0.1b10.tar.gz

Download URL modelscope_gradio_components-0.0.1b10.tar.gz
Size 6.1 MB
Tags Source
SHA-256 checksum
How to use checksums
ea68a5f97c3351724996d27bfa708ebaa4b5d31a485a45ad2d2b67e4320c6ac6
BLAKE2b-256 checksum
How to use checksums
ca52af8829f5e4a23ce1d1948340c94b40a5c5e918628c51ff706c5bf36cbc8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release files / modelscope_gradio_components-0.0.1b10-py3-none-any.whl

Download URL modelscope_gradio_components-0.0.1b10-py3-none-any.whl
Size 6.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e7ae68494c6819afcf5521eafccb14aa95cb13d65b293a523e149811a14af576
BLAKE2b-256 checksum
How to use checksums
5d7d8053948cb29a785baa36c093c419d33e68717014eb1ccc25e243741d4f98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page