Skip to main content

Python library for easily interacting with trained machine learning models

Project description

Modelscope Gradio Components



Modelscope HubDocs
中文  |  English

A components library for gradio.

quickstart

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

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

Component Docs

See docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modelscope_gradio_components-0.0.1b9.tar.gz (6.2 MB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page