Python library for easily interacting with trained machine learning models
Project description
Modelscope Gradio Components
Modelscope Hub | Docs
中文 | English
A components library for gradio.
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()
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for modelscope_gradio_components-0.0.1b9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50bf6ad653c0f6c762dc795a46fa47da32dae6b27ded9ced646deeb1f9a74193 |
|
MD5 | 273c3bb4e029b1cc782f967ea56c14d0 |
|
BLAKE2b-256 | 1ec5978fc538fe74a14a5e45472a6ea372d106b58014c8a125521c60b7f9a814 |
Close
Hashes for modelscope_gradio_components-0.0.1b9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89da1ac2849f562aaf24f091d432e200c6ea371d049afa640850df39ac24d9fd |
|
MD5 | fd9754cf8121b3b41b5a6845c0f7fb0d |
|
BLAKE2b-256 | ca1edda2f38d8147189c399dde4bdf475cedcee958be21b9859ceedd0df4d125 |