Chat_bot_one / Chat_ui
ONEROCKS's picture
Create Chat_ui
7013b8d verified
Raw History Blame Contribute Delete
1.44 kB
import gradio as gr
# KEEP your respond() function and any other AI logic above this
theme = gr.themes.Soft(
primary_hue="blue",
secondary_hue="gray"
).set(
button_primary_background_fill="linear-gradient(to right, #4285f4, #34a853)",
border_radius="12px",
font="Roboto",
input_background_fill="#fff",
background_fill_primary="#f1f3f4"
)
css = """
.gradio-container {
font-family: 'Roboto', sans-serif;
background-color: #f1f3f4;
padding-top: 30px;
}
.gr-chatbot {
background-color: white;
border-radius: 16px;
box-shadow: 0 4px 16px rgba(0,0,0,0.05);
padding: 20px;
max-width: 700px;
margin: auto;
}
.message.user {
background-color: #d2e3fc;
border-radius: 16px;
padding: 12px;
margin: 8px 0;
align-self: flex-end;
max-width: 80%;
}
.message.bot {
background-color: #f1f3f4;
border-radius: 16px;
padding: 12px;
margin: 8px 0;
max-width: 80%;
}
.gr-text-input input {
border-radius: 12px;
padding: 14px;
border: 1px solid #ccc;
font-size: 16px;
}
"""
# This is the new styled interface
chat = gr.ChatInterface(
fn=respond,
chatbot=gr.Chatbot(label="ONE AI").style(height=500, bubble_full_width=False),
title="Chat with ONE",
description="Your Gemini-styled AI chatbot.",
theme=theme,
css=css,
submit_btn="Send",
retry_btn="Try Again",
stop_btn="Stop"
)
chat.launch()