Revenue/iframe
0
1# This is a simple Gradio app that creates a chatbot with opaque dialog boxes.2import gradio as gr3 4# Define a function that returns a response to the user's message.5def respond(message, chat_history):6 # Simple response logic: echo the user's message with a greeting.7 bot_message = f"Echo: {message}"8 chat_history.append({"role": "user", "content": message})9 chat_history.append({"role": "assistant", "content": bot_message})10 return "", chat_history11 12# Create a Gradio interface for the chatbot with opaque dialog boxes.13with gr.Blocks(css="""14 body {background-color: transparent !important;}15 .gradio-container .gradio-chatbot .gradio-message .gradio-message-content {16 opacity: 0.2;17 }18""", theme=gr.themes.Base()) as demo:19 chatbot = gr.Chatbot(type="messages")20 msg = gr.Textbox(label="Enter your message")21 clear = gr.Button("Clear")22 23 # Set up the event listeners for the chatbot.24 msg.submit(respond, [msg, chatbot], [msg, chatbot])25 clear.click(lambda: None, None, chatbot, queue=False)26 27# Launch the interface.28demo.launch(show_error=True)