Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| css=""" | |
| #col-container { | |
| margin: auto; | |
| max-width: 800px; | |
| } | |
| """ | |
| def bot_response(history, message): | |
| for x in message["files"]: | |
| history.append([(x,), None]) | |
| if message["text"] is not None: | |
| history.append([message["text"], None]) | |
| response = "**That's cool!**" | |
| history[-1][1] = "" | |
| for character in response: | |
| history[-1][1] += character | |
| yield history | |
| with gr.Blocks(css=css, fill_height=True) as demo: | |
| with gr.Column(elem_id="col-container"): | |
| chatbot = gr.Chatbot( | |
| [], | |
| elem_id="chatbot", | |
| bubble_full_width=False, | |
| height=700, | |
| ) | |
| chat_input = gr.MultimodalTextbox(interactive=True, file_types=["file"], placeholder="Enter message or upload file...", show_label=False) | |
| chat_input.submit(bot_response, [chatbot, chat_input], [chatbot,]) | |
| demo.queue() | |
| if __name__ == "__main__": | |
| demo.launch() | |