Update app.py
Browse files12 unmodified lines131415161718191 unmodified line212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465661 unmodified line68697071727312 unmodified linesgr.Markdown("# Chatbot Interface")# Chat displaychatbot_component = gr.Chatbot(type="messages", label="Chat History", height=400) # Reduced height# Input box with integrated send buttonwith gr.Row(elem_id="input_container"):1 unmodified lineplaceholder="Type your message here...",label=None,elem_id="user_input",visible=False # Make the input box invisible)# Custom CSS to style the input with the integrated buttondemo.css = """#input_container {display: flex;align-items: center;margin-top: 10px;width: 100%;max-width: 600px;}#user_input {position: relative;width: 100%;border-radius: 8px;border: 1px solid #ccc;height: 40px;padding-right: 50px; /* Space for the send button */padding-left: 10px;box-sizing: border-box;visibility: hidden; /* Hide the input box */}#user_input::after {content: 'Send';position: absolute;right: 10px;top: 50%;transform: translateY(-50%);background-color: orange;color: white;border-radius: 5px;padding: 5px 10px;cursor: pointer;font-size: 14px;}#user_input::after:hover {background-color: darkorange;}"""# Link input submission to chatbot functionuser_input.submit(1 unmodified lineinputs=[user_input, chatbot_component],outputs=chatbot_component,)demo.launch()12 unmodified lines131415161718191 unmodified line212223242526272829301 unmodified line32333435363738394041424312 unmodified linesgr.Markdown("# Chatbot Interface")# Chat displaychatbot_component = gr.Chatbot(type="messages", label="Chat History", height=400) # Adjusted height# Input box with integrated send buttonwith gr.Row(elem_id="input_container"):1 unmodified lineplaceholder="Type your message here...",label=None,elem_id="user_input",lines=1, # Single line inputinteractive=True # Make it interactive)send_button = gr.Button("Send") # Separate send button# Link input submission to chatbot functionuser_input.submit(1 unmodified lineinputs=[user_input, chatbot_component],outputs=chatbot_component,)send_button.click(chatbot,inputs=[user_input, chatbot_component],outputs=chatbot_component,)demo.launch()
app.py+10-40