justmywyw's picture
Upload folder using huggingface_hub
630cbf4 verified
raw
history blame
850 Bytes
import time
import gradio as gr
import modelscope_gradio_components as mgr
def fn(input, chatbot):
chatbot.append([{
"text": input.text,
"files": input.files,
}, None])
yield {
user_input: mgr.MultimodalInput(interactive=False),
user_chatbot: chatbot
}
time.sleep(2)
chatbot[-1][1] = {"text": "Hello!"}
yield {user_chatbot: chatbot}
# ζ‰“ε­—ζœΊζ•ˆζžœη»“ζŸθ§¦ε‘
def flushed():
return mgr.MultimodalInput(interactive=True)
with gr.Blocks() as demo:
user_chatbot = mgr.Chatbot()
user_input = mgr.MultimodalInput()
user_input.submit(fn=fn,
inputs=[user_input, user_chatbot],
outputs=[user_input, user_chatbot])
user_chatbot.flushed(fn=flushed, outputs=[user_input])
if __name__ == "__main__":
demo.queue().launch()