srinuksv commited on
Commit
448c3da
1 Parent(s): c7691c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -44
app.py CHANGED
@@ -88,6 +88,7 @@ def predict(message,history):
88
  response = handle_query(message)
89
  return response
90
 
 
91
  # Create the chat interface with a custom layout function
92
  css = '''
93
  /* Style the chat container */
@@ -102,28 +103,36 @@ css = '''
102
  background-color: #fff;
103
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
104
  position: relative;
 
105
  }
106
 
107
- /* Style the logo and title container */
108
- .gradio-header {
109
  display: flex;
110
- align-items: center;
111
  margin-bottom: 20px;
112
- padding-bottom: 10px;
113
- border-bottom: 1px solid #ddd;
114
  }
115
 
116
  .gradio-logo img {
117
- height: 50px;
118
- margin-right: 10px;
119
  }
120
 
 
 
 
 
 
 
 
 
121
 
122
  /* Style the chat history */
123
  .gradio-chat-history {
124
  flex: 1;
125
  overflow-y: auto;
126
  padding: 15px;
 
127
  background-color: #f9f9f9;
128
  border-radius: 5px;
129
  margin-bottom: 10px;
@@ -163,61 +172,38 @@ css = '''
163
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
164
  }
165
 
166
- /* Style the user input field */
167
- .gradio-chat-input {
168
  display: flex;
169
- border: 1px solid #ddd;
170
- border-radius: 20px;
171
- padding: 10px;
172
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
173
- background-color: #fff;
174
- }
175
-
176
- .gradio-chat-input input {
177
- width: 100%;
178
  padding: 10px;
179
- border: none;
180
- outline: none;
181
- font-size: 16px;
182
- border-radius: 20px;
183
- }
184
-
185
- .gradio-chat-input button {
186
- padding: 10px 15px;
187
- background-color: #4A90E2;
188
- border: none;
189
- border-radius: 20px;
190
- color: white;
191
- font-size: 16px;
192
- cursor: pointer;
193
- margin-left: 10px;
194
- }
195
-
196
- .gradio-chat-input button:hover {
197
- background-color: #357ABD;
198
  }
199
 
200
  /* Remove Gradio footer */
201
  footer {
202
  display: none !important;
 
203
  }
204
  '''
205
 
206
- # Create a custom HTML block for the logo and title
207
- header_html = '''
208
- <div class="gradio-header">
209
- <div class="gradio-logo">
210
- <img src="https://redfernstech.com/wp-content/uploads/2024/05/RedfernsLogo_FinalV1.0-3-2048x575.png" alt="Company Logo">
211
- </div>
212
  </div>
213
  '''
214
 
215
  # Create a Blocks layout with the custom HTML and ChatInterface
216
  with gr.Blocks(css=css) as demo:
217
- gr.HTML(header_html)
218
  gr.ChatInterface(predict)
219
 
220
  # Launch the interface
221
  demo.launch()
222
 
223
 
 
 
88
  response = handle_query(message)
89
  return response
90
 
91
+
92
  # Create the chat interface with a custom layout function
93
  css = '''
94
  /* Style the chat container */
 
103
  background-color: #fff;
104
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
105
  position: relative;
106
+ height: 600px; /* Adjust the height of the container */
107
  }
108
 
109
+ /* Style the logo */
110
+ .gradio-logo {
111
  display: flex;
112
+ justify-content: center;
113
  margin-bottom: 20px;
 
 
114
  }
115
 
116
  .gradio-logo img {
117
+ width: 100%;
118
+ max-width: 300px;
119
  }
120
 
121
+ /* Style the title */
122
+ .gradio-title {
123
+ text-align: center;
124
+ font-weight: bold;
125
+ font-size: 24px;
126
+ margin-bottom: 20px;
127
+ color: #4A90E2;
128
+ }
129
 
130
  /* Style the chat history */
131
  .gradio-chat-history {
132
  flex: 1;
133
  overflow-y: auto;
134
  padding: 15px;
135
+ border-bottom: 1px solid #ddd;
136
  background-color: #f9f9f9;
137
  border-radius: 5px;
138
  margin-bottom: 10px;
 
172
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
173
  }
174
 
175
+ /* Style the footer */
176
+ .gradio-footer {
177
  display: flex;
 
 
 
 
 
 
 
 
 
178
  padding: 10px;
179
+ border-top: 1px solid #ddd;
180
+ background-color: #F8D7DA; /* Light red background color */
181
+ position: absolute;
182
+ bottom: 0;
183
+ width: calc(100% - 40px); /* Adjust width to match container padding */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  }
185
 
186
  /* Remove Gradio footer */
187
  footer {
188
  display: none !important;
189
+ background-color: #F8D7DA;
190
  }
191
  '''
192
 
193
+ # Create a custom HTML block for the logo
194
+ logo_html = '''
195
+ <div class="gradio-logo">
196
+ <img src="https://redfernstech.com/wp-content/uploads/2024/05/RedfernsLogo_FinalV1.0-3-2048x575.png" alt="Company Logo">
 
 
197
  </div>
198
  '''
199
 
200
  # Create a Blocks layout with the custom HTML and ChatInterface
201
  with gr.Blocks(css=css) as demo:
202
+ gr.HTML(logo_html)
203
  gr.ChatInterface(predict)
204
 
205
  # Launch the interface
206
  demo.launch()
207
 
208
 
209
+