This demo runs on local GPU for faster experience. For the API version, visit
this Space.
"
)
raw_history = gr.State([])
with gr.Row():
with gr.Column(scale=7):
chatbox = gr.Chatbot(
label="Chat",
type="messages",
height=600,
elem_classes="chatbot-container",
sanitize_html=False,
line_breaks=True
)
textbox = gr.Textbox(label="Message", lines=3)
with gr.Row():
send = gr.Button("Send", variant="primary")
clear = gr.Button("Clear")
with gr.Column(scale=3):
up = gr.File(label="Upload Files", file_count="multiple", file_types=["file"], type="filepath")
gr.Markdown("Supports images / videos / PPT / PDF")
gr.Markdown(
"The maximum supported input is 10 images or 1 video/PPT/PDF(less than 10 pages) in this demo. "
"During the conversation, video and images cannot be present at the same time."
)
sys = gr.Textbox(label="System Prompt", lines=6)
send.click(
chat,
inputs=[up, textbox, raw_history, sys],
outputs=[chatbox, raw_history, up, textbox]
)
textbox.submit(
chat,
inputs=[up, textbox, raw_history, sys],
outputs=[chatbox, raw_history, up, textbox]
)
clear.click(
reset,
outputs=[chatbox, raw_history, up, textbox]
)
if __name__ == "__main__":
demo.launch()