Spaces:
Sleeping
Sleeping
Try theme inside chatbot function
#13
by STSDerek - opened
app.py
CHANGED
|
@@ -4,21 +4,21 @@ from sentence_transformers import SentenceTransformer, util
|
|
| 4 |
# Load semantic similarity model
|
| 5 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
| 6 |
|
| 7 |
-
# Custom theme params (matches current website colors)
|
| 8 |
-
sts_theme = gr.themes.Default(
|
| 9 |
-
primary_hue="blue",
|
| 10 |
-
secondary_hue="orange",
|
| 11 |
-
neutral_hue="gray"
|
| 12 |
-
).set(
|
| 13 |
-
# VALID parameters (no chatbot-specific overrides)
|
| 14 |
-
button_primary_background_fill="#FF6B00", # Orange
|
| 15 |
-
button_primary_text_color="#FFFFFF", # White text
|
| 16 |
-
button_primary_background_fill_hover="#E05D00", # Darker orange
|
| 17 |
-
# body_background_fill="#E9ECEF", # Light gray (main bg)
|
| 18 |
-
# body_background_fill_dark="#E9ECEF", # Force light mode
|
| 19 |
-
block_background_fill="#FFFFFF", # Message bubbles
|
| 20 |
-
border_color_primary="#0056B3" # Dark blue borders
|
| 21 |
-
)
|
| 22 |
|
| 23 |
# SofTouch Systems FAQs
|
| 24 |
faq_data = {
|
|
@@ -97,14 +97,49 @@ def chatbot(message, history):
|
|
| 97 |
else:
|
| 98 |
return "I'm still learning. Try asking about our services, support, cybersecurity, or backups."
|
| 99 |
|
| 100 |
-
#iface = gr.ChatInterface(fn=chatbot, type="messages")
|
| 101 |
-
|
| 102 |
iface = gr.ChatInterface(
|
| 103 |
fn=chatbot,
|
| 104 |
-
title="VELMA - Virtual Engagement Liaison & Messaging Assistant",
|
| 105 |
description="Try asking about our services, support, cybersecurity, or backups.",
|
| 106 |
type="messages",
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
)
|
| 109 |
|
| 110 |
iface.launch(share=True)
|
|
|
|
| 4 |
# Load semantic similarity model
|
| 5 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
| 6 |
|
| 7 |
+
## Custom theme params (matches current website colors)
|
| 8 |
+
#sts_theme = gr.themes.Default(
|
| 9 |
+
# primary_hue="blue",
|
| 10 |
+
# secondary_hue="orange",
|
| 11 |
+
# neutral_hue="gray"
|
| 12 |
+
#).set(
|
| 13 |
+
# # VALID parameters (no chatbot-specific overrides)
|
| 14 |
+
# button_primary_background_fill="#FF6B00", # Orange
|
| 15 |
+
# button_primary_text_color="#FFFFFF", # White text
|
| 16 |
+
# button_primary_background_fill_hover="#E05D00", # Darker orange
|
| 17 |
+
## body_background_fill="#E9ECEF", # Light gray (main bg)
|
| 18 |
+
## body_background_fill_dark="#E9ECEF", # Force light mode
|
| 19 |
+
# block_background_fill="#FFFFFF", # Message bubbles
|
| 20 |
+
# border_color_primary="#0056B3" # Dark blue borders
|
| 21 |
+
#)
|
| 22 |
|
| 23 |
# SofTouch Systems FAQs
|
| 24 |
faq_data = {
|
|
|
|
| 97 |
else:
|
| 98 |
return "I'm still learning. Try asking about our services, support, cybersecurity, or backups."
|
| 99 |
|
|
|
|
|
|
|
| 100 |
iface = gr.ChatInterface(
|
| 101 |
fn=chatbot,
|
| 102 |
+
title="VELMA© - Virtual Engagement Liaison & Messaging Assistant",
|
| 103 |
description="Try asking about our services, support, cybersecurity, or backups.",
|
| 104 |
type="messages",
|
| 105 |
+
css="""
|
| 106 |
+
.gradio-container {
|
| 107 |
+
background: #e9ecef !important;
|
| 108 |
+
border-radius: 8px !important;
|
| 109 |
+
}
|
| 110 |
+
.chatbot {
|
| 111 |
+
display: flex !important;
|
| 112 |
+
flex-direction: column !important;
|
| 113 |
+
gap: 8px !important;
|
| 114 |
+
}
|
| 115 |
+
.user-message {
|
| 116 |
+
padding: 10px 16px !important;
|
| 117 |
+
margin: 4px 0 !important;
|
| 118 |
+
border-radius: 18px 18px 0 18px !important;
|
| 119 |
+
background: #0056b3 !important;
|
| 120 |
+
color: white !important;
|
| 121 |
+
max-width: 80%;
|
| 122 |
+
align-self: flex-end;
|
| 123 |
+
}
|
| 124 |
+
.bot-message {
|
| 125 |
+
padding: 10px 16px !important;
|
| 126 |
+
margin: 4px 0 !important;
|
| 127 |
+
border-radius: 18px 18px 18px 0 !important;
|
| 128 |
+
background: white !important;
|
| 129 |
+
border: 1px solid #ddd !important;
|
| 130 |
+
max-width: 80%;
|
| 131 |
+
align-self: flex-start;
|
| 132 |
+
}
|
| 133 |
+
.submit-button {
|
| 134 |
+
background: #ff6b00 !important;
|
| 135 |
+
color: white !important;
|
| 136 |
+
}
|
| 137 |
+
.submit-button:hover {
|
| 138 |
+
background: #e05d00 !important;
|
| 139 |
+
}
|
| 140 |
+
""",
|
| 141 |
+
allow_screenshot=False,
|
| 142 |
+
theme=gr.themes.Soft() # Optional: Start with a clean theme
|
| 143 |
)
|
| 144 |
|
| 145 |
iface.launch(share=True)
|