Update app.py
Browse files
app.py
CHANGED
|
@@ -49,7 +49,7 @@ def chatbot(history, query):
|
|
| 49 |
history.append((query, response))
|
| 50 |
return history, history
|
| 51 |
|
| 52 |
-
# Custom CSS for a WhatsApp-like mobile view
|
| 53 |
custom_css = """
|
| 54 |
/* General container styling */
|
| 55 |
.gradio-container {
|
|
@@ -90,25 +90,22 @@ p {
|
|
| 90 |
flex-direction: column-reverse; /* Bottom-up chat like WhatsApp */
|
| 91 |
}
|
| 92 |
|
| 93 |
-
/* Chat bubbles: WhatsApp-style design */
|
| 94 |
.chatbot .bubble {
|
| 95 |
border-radius: 10px !important;
|
| 96 |
padding: 10px 15px !important;
|
| 97 |
margin: 5px 10px !important;
|
| 98 |
max-width: 65% !important;
|
| 99 |
font-size: 0.9em !important;
|
|
|
|
| 100 |
animation: slideIn 0.3s ease-in-out;
|
| 101 |
transition: transform 0.2s ease;
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
.chatbot .bubble:hover {
|
| 105 |
-
transform: scale(1.01);
|
| 106 |
}
|
| 107 |
|
| 108 |
/* User bubble: Right-aligned, green like WhatsApp sender */
|
| 109 |
.chatbot .bubble:nth-child(odd) {
|
| 110 |
background: #dcf8c6 !important; /* WhatsApp sender bubble color */
|
| 111 |
-
color: #000 !important;
|
| 112 |
margin-left: auto !important;
|
| 113 |
align-self: flex-end !important;
|
| 114 |
}
|
|
@@ -116,7 +113,6 @@ p {
|
|
| 116 |
/* Bot bubble: Left-aligned, light gray like WhatsApp receiver */
|
| 117 |
.chatbot .bubble:nth-child(even) {
|
| 118 |
background: #fff !important; /* WhatsApp receiver bubble color */
|
| 119 |
-
color: #000 !important;
|
| 120 |
margin-right: auto !important;
|
| 121 |
align-self: flex-start !important;
|
| 122 |
}
|
|
@@ -135,7 +131,7 @@ p {
|
|
| 135 |
align-items: center !important;
|
| 136 |
}
|
| 137 |
|
| 138 |
-
/* Textbox styling: Compact and WhatsApp-like */
|
| 139 |
input[type="text"] {
|
| 140 |
border: 1px solid #ccc !important;
|
| 141 |
border-radius: 20px !important;
|
|
@@ -144,6 +140,11 @@ input[type="text"] {
|
|
| 144 |
box-shadow: none !important;
|
| 145 |
flex-grow: 1 !important;
|
| 146 |
margin-right: 10px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
}
|
| 148 |
|
| 149 |
input[type="text"]:focus {
|
|
@@ -155,12 +156,13 @@ input[type="text"]:focus {
|
|
| 155 |
button {
|
| 156 |
border-radius: 20px !important;
|
| 157 |
background: #075e54 !important; /* WhatsApp green */
|
| 158 |
-
color: white !important;
|
| 159 |
padding: 12px 25px !important; /* Larger size */
|
| 160 |
font-size: 0.9em !important;
|
| 161 |
border: none !important;
|
| 162 |
min-width: 100px !important;
|
| 163 |
transition: background 0.3s ease !important;
|
|
|
|
| 164 |
}
|
| 165 |
|
| 166 |
button:hover {
|
|
@@ -175,6 +177,7 @@ button[aria-label="Clear Chat"] {
|
|
| 175 |
min-width: 80px !important;
|
| 176 |
margin-top: 10px !important;
|
| 177 |
align-self: center !important;
|
|
|
|
| 178 |
}
|
| 179 |
|
| 180 |
button[aria-label="Clear Chat"]:hover {
|
|
@@ -211,7 +214,7 @@ button[aria-label="Clear Chat"]:hover {
|
|
| 211 |
background: #054d44;
|
| 212 |
}
|
| 213 |
|
| 214 |
-
/* Mobile-specific adjustments
|
| 215 |
@media (max-width: 768px) {
|
| 216 |
.chatbot {
|
| 217 |
height: 80vh !important;
|
|
|
|
| 49 |
history.append((query, response))
|
| 50 |
return history, history
|
| 51 |
|
| 52 |
+
# Custom CSS for a WhatsApp-like mobile view with corrected text display
|
| 53 |
custom_css = """
|
| 54 |
/* General container styling */
|
| 55 |
.gradio-container {
|
|
|
|
| 90 |
flex-direction: column-reverse; /* Bottom-up chat like WhatsApp */
|
| 91 |
}
|
| 92 |
|
| 93 |
+
/* Chat bubbles: WhatsApp-style design with corrected text */
|
| 94 |
.chatbot .bubble {
|
| 95 |
border-radius: 10px !important;
|
| 96 |
padding: 10px 15px !important;
|
| 97 |
margin: 5px 10px !important;
|
| 98 |
max-width: 65% !important;
|
| 99 |
font-size: 0.9em !important;
|
| 100 |
+
word-wrap: break-word !important; /* Ensure text wraps properly */
|
| 101 |
animation: slideIn 0.3s ease-in-out;
|
| 102 |
transition: transform 0.2s ease;
|
| 103 |
+
color: #000 !important; /* Ensure text is visible */
|
|
|
|
|
|
|
|
|
|
| 104 |
}
|
| 105 |
|
| 106 |
/* User bubble: Right-aligned, green like WhatsApp sender */
|
| 107 |
.chatbot .bubble:nth-child(odd) {
|
| 108 |
background: #dcf8c6 !important; /* WhatsApp sender bubble color */
|
|
|
|
| 109 |
margin-left: auto !important;
|
| 110 |
align-self: flex-end !important;
|
| 111 |
}
|
|
|
|
| 113 |
/* Bot bubble: Left-aligned, light gray like WhatsApp receiver */
|
| 114 |
.chatbot .bubble:nth-child(even) {
|
| 115 |
background: #fff !important; /* WhatsApp receiver bubble color */
|
|
|
|
| 116 |
margin-right: auto !important;
|
| 117 |
align-self: flex-start !important;
|
| 118 |
}
|
|
|
|
| 131 |
align-items: center !important;
|
| 132 |
}
|
| 133 |
|
| 134 |
+
/* Textbox styling: Compact and WhatsApp-like with correct placeholder */
|
| 135 |
input[type="text"] {
|
| 136 |
border: 1px solid #ccc !important;
|
| 137 |
border-radius: 20px !important;
|
|
|
|
| 140 |
box-shadow: none !important;
|
| 141 |
flex-grow: 1 !important;
|
| 142 |
margin-right: 10px !important;
|
| 143 |
+
color: #000 !important; /* Ensure text is visible */
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
input[type="text"]::placeholder {
|
| 147 |
+
color: #757575 !important; /* Gray placeholder like WhatsApp */
|
| 148 |
}
|
| 149 |
|
| 150 |
input[type="text"]:focus {
|
|
|
|
| 156 |
button {
|
| 157 |
border-radius: 20px !important;
|
| 158 |
background: #075e54 !important; /* WhatsApp green */
|
| 159 |
+
color: white !important; /* Ensure text is visible */
|
| 160 |
padding: 12px 25px !important; /* Larger size */
|
| 161 |
font-size: 0.9em !important;
|
| 162 |
border: none !important;
|
| 163 |
min-width: 100px !important;
|
| 164 |
transition: background 0.3s ease !important;
|
| 165 |
+
text-align: center !important; /* Center text */
|
| 166 |
}
|
| 167 |
|
| 168 |
button:hover {
|
|
|
|
| 177 |
min-width: 80px !important;
|
| 178 |
margin-top: 10px !important;
|
| 179 |
align-self: center !important;
|
| 180 |
+
color: #000 !important; /* Ensure text is visible */
|
| 181 |
}
|
| 182 |
|
| 183 |
button[aria-label="Clear Chat"]:hover {
|
|
|
|
| 214 |
background: #054d44;
|
| 215 |
}
|
| 216 |
|
| 217 |
+
/* Mobile-specific adjustments */
|
| 218 |
@media (max-width: 768px) {
|
| 219 |
.chatbot {
|
| 220 |
height: 80vh !important;
|