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 with
|
| 53 |
custom_css = """
|
| 54 |
/* General container styling */
|
| 55 |
.gradio-container {
|
|
@@ -63,7 +63,7 @@ custom_css = """
|
|
| 63 |
/* Header styling */
|
| 64 |
h1 {
|
| 65 |
color: #075e54 !important; /* WhatsApp green */
|
| 66 |
-
font-size: 1.
|
| 67 |
text-align: center;
|
| 68 |
margin: 10px 0;
|
| 69 |
text-shadow: none;
|
|
@@ -71,7 +71,7 @@ h1 {
|
|
| 71 |
|
| 72 |
p {
|
| 73 |
color: #075e54 !important;
|
| 74 |
-
font-size:
|
| 75 |
text-align: center;
|
| 76 |
margin-bottom: 10px;
|
| 77 |
}
|
|
@@ -90,16 +90,15 @@ p {
|
|
| 90 |
flex-direction: column-reverse; /* Bottom-up chat like WhatsApp */
|
| 91 |
}
|
| 92 |
|
| 93 |
-
/* Chat bubbles: WhatsApp-style design with
|
| 94 |
.chatbot .bubble {
|
| 95 |
border-radius: 10px !important;
|
| 96 |
-
padding:
|
| 97 |
-
margin:
|
| 98 |
max-width: 65% !important;
|
| 99 |
-
font-size: 0.
|
| 100 |
word-wrap: break-word !important; /* Ensure text wraps properly */
|
| 101 |
-
|
| 102 |
-
transition: transform 0.2s ease;
|
| 103 |
color: #000 !important; /* Ensure text is visible */
|
| 104 |
}
|
| 105 |
|
|
@@ -124,7 +123,7 @@ p {
|
|
| 124 |
width: 100% !important;
|
| 125 |
max-width: 100% !important;
|
| 126 |
background: #f0f0f0 !important; /* Light gray for input area */
|
| 127 |
-
padding:
|
| 128 |
box-shadow: 0 -2px 5px rgba(0,0,0,0.1) !important;
|
| 129 |
z-index: 1000 !important;
|
| 130 |
display: flex !important;
|
|
@@ -135,16 +134,17 @@ p {
|
|
| 135 |
input[type="text"] {
|
| 136 |
border: 1px solid #ccc !important;
|
| 137 |
border-radius: 20px !important;
|
| 138 |
-
padding:
|
| 139 |
-
font-size: 0.
|
| 140 |
box-shadow: none !important;
|
| 141 |
flex-grow: 1 !important;
|
| 142 |
-
margin-right:
|
| 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 {
|
|
@@ -157,10 +157,10 @@ button {
|
|
| 157 |
border-radius: 20px !important;
|
| 158 |
background: #075e54 !important; /* WhatsApp green */
|
| 159 |
color: white !important; /* Ensure text is visible */
|
| 160 |
-
padding:
|
| 161 |
-
font-size: 0.
|
| 162 |
border: none !important;
|
| 163 |
-
min-width:
|
| 164 |
transition: background 0.3s ease !important;
|
| 165 |
text-align: center !important; /* Center text */
|
| 166 |
}
|
|
@@ -172,10 +172,10 @@ button:hover {
|
|
| 172 |
/* Clear button: Reduced size and WhatsApp-like placement */
|
| 173 |
button[aria-label="Clear Chat"] {
|
| 174 |
background: #e0e0e0 !important;
|
| 175 |
-
padding:
|
| 176 |
font-size: 0.8em !important;
|
| 177 |
-
min-width:
|
| 178 |
-
margin-top:
|
| 179 |
align-self: center !important;
|
| 180 |
color: #000 !important; /* Ensure text is visible */
|
| 181 |
}
|
|
@@ -223,10 +223,10 @@ button[aria-label="Clear Chat"]:hover {
|
|
| 223 |
padding: 5px !important;
|
| 224 |
}
|
| 225 |
input[type="text"] {
|
| 226 |
-
padding:
|
| 227 |
}
|
| 228 |
button {
|
| 229 |
-
padding:
|
| 230 |
}
|
| 231 |
}
|
| 232 |
"""
|
|
|
|
| 49 |
history.append((query, response))
|
| 50 |
return history, history
|
| 51 |
|
| 52 |
+
# Custom CSS for a WhatsApp-like mobile view with adjusted text size
|
| 53 |
custom_css = """
|
| 54 |
/* General container styling */
|
| 55 |
.gradio-container {
|
|
|
|
| 63 |
/* Header styling */
|
| 64 |
h1 {
|
| 65 |
color: #075e54 !important; /* WhatsApp green */
|
| 66 |
+
font-size: 1.5em !important; /* Reduced header size */
|
| 67 |
text-align: center;
|
| 68 |
margin: 10px 0;
|
| 69 |
text-shadow: none;
|
|
|
|
| 71 |
|
| 72 |
p {
|
| 73 |
color: #075e54 !important;
|
| 74 |
+
font-size: 0.9em !important; /* Reduced subtitle size */
|
| 75 |
text-align: center;
|
| 76 |
margin-bottom: 10px;
|
| 77 |
}
|
|
|
|
| 90 |
flex-direction: column-reverse; /* Bottom-up chat like WhatsApp */
|
| 91 |
}
|
| 92 |
|
| 93 |
+
/* Chat bubbles: WhatsApp-style design with reduced text size */
|
| 94 |
.chatbot .bubble {
|
| 95 |
border-radius: 10px !important;
|
| 96 |
+
padding: 8px 12px !important; /* Reduced padding */
|
| 97 |
+
margin: 4px 8px !important; /* Reduced margin */
|
| 98 |
max-width: 65% !important;
|
| 99 |
+
font-size: 0.85em !important; /* Reduced to normal size (approx 14px) */
|
| 100 |
word-wrap: break-word !important; /* Ensure text wraps properly */
|
| 101 |
+
line-height: 1.3 !important; /* Adjusted for readability */
|
|
|
|
| 102 |
color: #000 !important; /* Ensure text is visible */
|
| 103 |
}
|
| 104 |
|
|
|
|
| 123 |
width: 100% !important;
|
| 124 |
max-width: 100% !important;
|
| 125 |
background: #f0f0f0 !important; /* Light gray for input area */
|
| 126 |
+
padding: 8px !important; /* Reduced padding */
|
| 127 |
box-shadow: 0 -2px 5px rgba(0,0,0,0.1) !important;
|
| 128 |
z-index: 1000 !important;
|
| 129 |
display: flex !important;
|
|
|
|
| 134 |
input[type="text"] {
|
| 135 |
border: 1px solid #ccc !important;
|
| 136 |
border-radius: 20px !important;
|
| 137 |
+
padding: 8px 12px !important; /* Reduced padding */
|
| 138 |
+
font-size: 0.85em !important; /* Reduced to normal size */
|
| 139 |
box-shadow: none !important;
|
| 140 |
flex-grow: 1 !important;
|
| 141 |
+
margin-right: 8px !important; /* Reduced margin */
|
| 142 |
color: #000 !important; /* Ensure text is visible */
|
| 143 |
}
|
| 144 |
|
| 145 |
input[type="text"]::placeholder {
|
| 146 |
color: #757575 !important; /* Gray placeholder like WhatsApp */
|
| 147 |
+
font-size: 0.85em !important; /* Match textbox size */
|
| 148 |
}
|
| 149 |
|
| 150 |
input[type="text"]:focus {
|
|
|
|
| 157 |
border-radius: 20px !important;
|
| 158 |
background: #075e54 !important; /* WhatsApp green */
|
| 159 |
color: white !important; /* Ensure text is visible */
|
| 160 |
+
padding: 10px 20px !important; /* Adjusted for balance */
|
| 161 |
+
font-size: 0.85em !important; /* Reduced to normal size */
|
| 162 |
border: none !important;
|
| 163 |
+
min-width: 90px !important; /* Slightly reduced */
|
| 164 |
transition: background 0.3s ease !important;
|
| 165 |
text-align: center !important; /* Center text */
|
| 166 |
}
|
|
|
|
| 172 |
/* Clear button: Reduced size and WhatsApp-like placement */
|
| 173 |
button[aria-label="Clear Chat"] {
|
| 174 |
background: #e0e0e0 !important;
|
| 175 |
+
padding: 6px 12px !important; /* Further reduced */
|
| 176 |
font-size: 0.8em !important;
|
| 177 |
+
min-width: 70px !important; /* Further reduced */
|
| 178 |
+
margin-top: 8px !important;
|
| 179 |
align-self: center !important;
|
| 180 |
color: #000 !important; /* Ensure text is visible */
|
| 181 |
}
|
|
|
|
| 223 |
padding: 5px !important;
|
| 224 |
}
|
| 225 |
input[type="text"] {
|
| 226 |
+
padding: 6px 10px !important;
|
| 227 |
}
|
| 228 |
button {
|
| 229 |
+
padding: 8px 18px !important;
|
| 230 |
}
|
| 231 |
}
|
| 232 |
"""
|