dschandra commited on
Commit
c4bb6ce
·
verified ·
1 Parent(s): 5d0c81e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -21
app.py CHANGED
@@ -49,21 +49,21 @@ def chatbot(history, query):
49
  history.append((query, response))
50
  return history, history
51
 
52
- # Custom CSS for a normal chatbot visual design
53
  custom_css = """
54
  /* General container styling */
55
  .gradio-container {
56
  font-family: 'Arial', sans-serif;
57
- background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); /* Neutral gradient */
58
  min-height: 100vh;
59
  padding: 0;
60
  margin: 0;
61
- font-size: 14px; /* Base font size */
62
  }
63
 
64
  /* Header styling */
65
  h1 {
66
- color: #2c3e50 !important; /* Dark blue for professionalism */
67
  font-size: 24px !important;
68
  text-align: center;
69
  margin: 15px 0;
@@ -71,7 +71,7 @@ h1 {
71
  }
72
 
73
  p {
74
- color: #34495e !important; /* Slightly lighter blue */
75
  font-size: 14px !important;
76
  text-align: center;
77
  margin-bottom: 15px;
@@ -85,36 +85,39 @@ p {
85
  padding: 10px !important;
86
  max-width: 800px !important;
87
  margin: 0 auto !important;
88
- height: 70vh !important; /* Adjusted for normal view */
89
  overflow-y: auto !important;
90
- display: block; /* Reset to default flow */
 
91
  }
92
 
93
- /* Chat bubbles: Normal design */
94
  .chatbot .bubble {
 
95
  border-radius: 8px !important;
96
- padding: 8px 12px !important;
97
  margin: 5px 0 !important;
98
  max-width: 70% !important;
99
- font-size: 14px !important; /* Normal text size */
100
- min-height: 30px !important; /* Controlled minimum height */
101
- min-width: 60px !important; /* Controlled minimum width */
102
  word-wrap: break-word !important;
103
- line-height: 1.4 !important; /* Readable line spacing */
104
- color: #2c3e50 !important; /* Consistent text color */
 
105
  }
106
 
107
  /* User bubble: Right-aligned, light blue */
108
  .chatbot .bubble:nth-child(odd) {
109
- background: #3498db !important; /* Light blue for user */
110
- color: #ffffff !important; /* White text for contrast */
111
  margin-left: auto !important;
112
  align-self: flex-end !important;
113
  }
114
 
115
  /* Bot bubble: Left-aligned, light gray */
116
  .chatbot .bubble:nth-child(even) {
117
- background: #ecf0f1 !important; /* Light gray for bot */
118
  margin-right: auto !important;
119
  align-self: flex-start !important;
120
  }
@@ -128,6 +131,7 @@ p {
128
  display: flex !important;
129
  align-items: center !important;
130
  background: transparent !important;
 
131
  }
132
 
133
  /* Textbox styling */
@@ -140,10 +144,11 @@ input[type="text"] {
140
  flex-grow: 1 !important;
141
  margin-right: 10px !important;
142
  color: #2c3e50 !important;
 
143
  }
144
 
145
  input[type="text"]::placeholder {
146
- color: #7f8c8d !important; /* Gray placeholder */
147
  font-size: 14px !important;
148
  }
149
 
@@ -155,7 +160,7 @@ input[type="text"]:focus {
155
  /* Send button */
156
  button {
157
  border-radius: 4px !important;
158
- background: #3498db !important; /* Matching user bubble */
159
  color: white !important;
160
  padding: 8px 20px !important;
161
  font-size: 14px !important;
@@ -163,6 +168,7 @@ button {
163
  min-width: 80px !important;
164
  transition: background 0.3s ease !important;
165
  text-align: center !important;
 
166
  }
167
 
168
  button:hover {
@@ -171,13 +177,14 @@ button:hover {
171
 
172
  /* Clear button */
173
  button[aria-label="Clear Chat"] {
174
- background: #bdc3c7 !important; /* Silver gray */
175
  padding: 6px 15px !important;
176
  font-size: 14px !important;
177
  min-width: 90px !important;
178
  margin-top: 10px !important;
179
  align-self: center !important;
180
  color: #ffffff !important;
 
181
  }
182
 
183
  button[aria-label="Clear Chat"]:hover {
@@ -206,7 +213,7 @@ button[aria-label="Clear Chat"]:hover {
206
  @media (max-width: 768px) {
207
  .chatbot {
208
  max-width: 100% !important;
209
- height: 65vh !important; /* Adjusted for mobile */
210
  margin: 0 !important;
211
  }
212
  .gradio-row:last-child {
 
49
  history.append((query, response))
50
  return history, history
51
 
52
+ # Custom CSS for a normal chatbot visual design with adjusted bubbles
53
  custom_css = """
54
  /* General container styling */
55
  .gradio-container {
56
  font-family: 'Arial', sans-serif;
57
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
58
  min-height: 100vh;
59
  padding: 0;
60
  margin: 0;
61
+ font-size: 14px;
62
  }
63
 
64
  /* Header styling */
65
  h1 {
66
+ color: #2c3e50 !important;
67
  font-size: 24px !important;
68
  text-align: center;
69
  margin: 15px 0;
 
71
  }
72
 
73
  p {
74
+ color: #34495e !important;
75
  font-size: 14px !important;
76
  text-align: center;
77
  margin-bottom: 15px;
 
85
  padding: 10px !important;
86
  max-width: 800px !important;
87
  margin: 0 auto !important;
88
+ height: 70vh !important;
89
  overflow-y: auto !important;
90
+ display: block;
91
+ box-sizing: border-box !important; /* Ensure consistent sizing */
92
  }
93
 
94
+ /* Chat bubbles: Normal design without border */
95
  .chatbot .bubble {
96
+ border: none !important; /* Explicitly remove border */
97
  border-radius: 8px !important;
98
+ padding: 6px 10px !important; /* Reduced padding */
99
  margin: 5px 0 !important;
100
  max-width: 70% !important;
101
+ font-size: 14px !important;
102
+ min-height: 20px !important; /* Reduced minimum height */
103
+ min-width: 50px !important; /* Reduced minimum width */
104
  word-wrap: break-word !important;
105
+ line-height: 1.4 !important;
106
+ color: #2c3e50 !important;
107
+ box-sizing: border-box !important; /* Include padding in size */
108
  }
109
 
110
  /* User bubble: Right-aligned, light blue */
111
  .chatbot .bubble:nth-child(odd) {
112
+ background: #3498db !important;
113
+ color: #ffffff !important;
114
  margin-left: auto !important;
115
  align-self: flex-end !important;
116
  }
117
 
118
  /* Bot bubble: Left-aligned, light gray */
119
  .chatbot .bubble:nth-child(even) {
120
+ background: #ecf0f1 !important;
121
  margin-right: auto !important;
122
  align-self: flex-start !important;
123
  }
 
131
  display: flex !important;
132
  align-items: center !important;
133
  background: transparent !important;
134
+ box-sizing: border-box !important;
135
  }
136
 
137
  /* Textbox styling */
 
144
  flex-grow: 1 !important;
145
  margin-right: 10px !important;
146
  color: #2c3e50 !important;
147
+ box-sizing: border-box !important;
148
  }
149
 
150
  input[type="text"]::placeholder {
151
+ color: #7f8c8d !important;
152
  font-size: 14px !important;
153
  }
154
 
 
160
  /* Send button */
161
  button {
162
  border-radius: 4px !important;
163
+ background: #3498db !important;
164
  color: white !important;
165
  padding: 8px 20px !important;
166
  font-size: 14px !important;
 
168
  min-width: 80px !important;
169
  transition: background 0.3s ease !important;
170
  text-align: center !important;
171
+ box-sizing: border-box !important;
172
  }
173
 
174
  button:hover {
 
177
 
178
  /* Clear button */
179
  button[aria-label="Clear Chat"] {
180
+ background: #bdc3c7 !important;
181
  padding: 6px 15px !important;
182
  font-size: 14px !important;
183
  min-width: 90px !important;
184
  margin-top: 10px !important;
185
  align-self: center !important;
186
  color: #ffffff !important;
187
+ box-sizing: border-box !important;
188
  }
189
 
190
  button[aria-label="Clear Chat"]:hover {
 
213
  @media (max-width: 768px) {
214
  .chatbot {
215
  max-width: 100% !important;
216
+ height: 65vh !important;
217
  margin: 0 !important;
218
  }
219
  .gradio-row:last-child {