import json
import gradio as gr
import modelscope_studio as mgr
# `label` will display on the page, and `value` is the actual selected value.
options = [{"label": "A", "value": "a"}, "b", "c"]
conversation = [[
None, f"""
Single Select:
Multiple Select:
Vertical Direction:
Card Shape:
"""
]]
# The custom data must be marked by `gr.EventData`
def fn(data: gr.EventData):
print(data._data)
with gr.Blocks() as demo:
chatbot = mgr.Chatbot(
value=conversation,
flushing=False,
height=600,
)
# All custom tags will trigger the custom event
chatbot.custom(fn=fn)
if __name__ == "__main__":
demo.queue().launch()