jhparmar commited on
Commit
0b19438
·
verified ·
1 Parent(s): 32365c6

undefined - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +322 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Multi Agentic Real Estate Chatbot Image Text Based
3
- emoji: 📈
4
- colorFrom: indigo
5
- colorTo: purple
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: multi-agentic-real-estate-chatbot-image-text-based
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: green
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,322 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>RealEstate AI Assistant</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .chat-container {
11
+ height: calc(100vh - 180px);
12
+ }
13
+ .agent-1-bg {
14
+ background-color: #f0f9ff;
15
+ }
16
+ .agent-2-bg {
17
+ background-color: #f5f3ff;
18
+ }
19
+ .message-animation {
20
+ animation: fadeIn 0.3s ease-in-out;
21
+ }
22
+ @keyframes fadeIn {
23
+ from { opacity: 0; transform: translateY(10px); }
24
+ to { opacity: 1; transform: translateY(0); }
25
+ }
26
+ .file-input-label {
27
+ transition: all 0.3s ease;
28
+ }
29
+ .file-input-label:hover {
30
+ background-color: #e0e7ff;
31
+ }
32
+ .preview-image {
33
+ max-height: 200px;
34
+ max-width: 100%;
35
+ border-radius: 8px;
36
+ object-fit: contain;
37
+ }
38
+ .typing-indicator span {
39
+ display: inline-block;
40
+ width: 8px;
41
+ height: 8px;
42
+ border-radius: 50%;
43
+ background-color: #6366f1;
44
+ margin: 0 2px;
45
+ animation: bounce 1.4s infinite ease-in-out both;
46
+ }
47
+ .typing-indicator span:nth-child(1) {
48
+ animation-delay: -0.32s;
49
+ }
50
+ .typing-indicator span:nth-child(2) {
51
+ animation-delay: -0.16s;
52
+ }
53
+ @keyframes bounce {
54
+ 0%, 80%, 100% { transform: scale(0); }
55
+ 40% { transform: scale(1); }
56
+ }
57
+ </style>
58
+ </head>
59
+ <body class="bg-gray-50">
60
+ <!-- Developer Info -->
61
+ <div class="bg-indigo-900 text-white p-2 text-center text-sm">
62
+ <p>Developed by: Jatinkumar Parmar | Contact: parmarjatin4911@gmail.com</p>
63
+ </div>
64
+
65
+ <div class="container mx-auto max-w-4xl p-4">
66
+ <!-- Header -->
67
+ <div class="flex flex-col md:flex-row justify-between items-center mb-6">
68
+ <div class="flex items-center mb-4 md:mb-0">
69
+ <i class="fas fa-home text-indigo-600 text-3xl mr-3"></i>
70
+ <h1 class="text-2xl font-bold text-gray-800">RealEstate AI Assistant</h1>
71
+ </div>
72
+ <div class="flex space-x-2">
73
+ <button id="agent1Btn" class="px-4 py-2 bg-indigo-600 text-white rounded-lg shadow-md hover:bg-indigo-700 transition flex items-center">
74
+ <i class="fas fa-search mr-2"></i> Property Inspector
75
+ </button>
76
+ <button id="agent2Btn" class="px-4 py-2 bg-purple-600 text-white rounded-lg shadow-md hover:bg-purple-700 transition flex items-center">
77
+ <i class="fas fa-question-circle mr-2"></i> Tenancy FAQ
78
+ </button>
79
+ </div>
80
+ </div>
81
+
82
+ <!-- Chat Container -->
83
+ <div id="chatContainer" class="chat-container bg-white rounded-xl shadow-lg overflow-hidden flex flex-col">
84
+ <!-- Chat Header -->
85
+ <div id="chatHeader" class="agent-1-bg p-4 flex items-center border-b">
86
+ <div id="agent1Icon" class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
87
+ <i class="fas fa-search text-indigo-600"></i>
88
+ </div>
89
+ <div id="agent2Icon" class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3 hidden">
90
+ <i class="fas fa-question-circle text-purple-600"></i>
91
+ </div>
92
+ <div>
93
+ <h2 id="agentTitle" class="font-semibold text-gray-800">Property Inspector</h2>
94
+ <p id="agentDescription" class="text-sm text-gray-600">Upload property images or describe issues for expert analysis</p>
95
+ </div>
96
+ </div>
97
+
98
+ <!-- Messages Area -->
99
+ <div id="messagesArea" class="flex-1 overflow-y-auto p-4 space-y-4">
100
+ <!-- Welcome Message -->
101
+ <div class="flex justify-start">
102
+ <div class="max-w-xs md:max-w-md lg:max-w-lg bg-indigo-100 rounded-lg p-4 message-animation">
103
+ <p class="text-gray-800">Hello! I'm your Real Estate AI Assistant. I can help with:</p>
104
+ <ul class="list-disc pl-5 mt-2 text-gray-700">
105
+ <li>Identifying property issues from images</li>
106
+ <li>Answering tenancy law questions</li>
107
+ </ul>
108
+ <p class="mt-2 text-gray-800">How can I assist you today?</p>
109
+ </div>
110
+ </div>
111
+ </div>
112
+
113
+ <!-- Input Area -->
114
+ <div class="border-t p-4 bg-gray-50">
115
+ <!-- Image Preview -->
116
+ <div id="imagePreviewContainer" class="mb-3 hidden">
117
+ <div class="flex items-center justify-between bg-indigo-50 p-2 rounded-lg">
118
+ <div class="flex items-center">
119
+ <img id="previewImage" src="" alt="Preview" class="preview-image mr-3">
120
+ <span id="fileName" class="text-sm text-gray-700"></span>
121
+ </div>
122
+ <button id="removeImageBtn" class="text-red-500 hover:text-red-700">
123
+ <i class="fas fa-times"></i>
124
+ </button>
125
+ </div>
126
+ </div>
127
+
128
+ <!-- Typing Indicator -->
129
+ <div id="typingIndicator" class="typing-indicator mb-2 hidden">
130
+ <div class="flex items-center text-indigo-600">
131
+ <span></span>
132
+ <span></span>
133
+ <span></span>
134
+ <span class="ml-2 text-sm">Agent is typing...</span>
135
+ </div>
136
+ </div>
137
+
138
+ <!-- Input Form -->
139
+ <form id="chatForm" class="flex items-end space-x-2">
140
+ <div class="flex-1 relative">
141
+ <textarea id="messageInput" rows="1" class="w-full border border-gray-300 rounded-lg py-2 px-4 focus:outline-none focus:ring-2 focus:ring-indigo-500 resize-none" placeholder="Type your message..."></textarea>
142
+ <label for="fileInput" class="file-input-label absolute right-2 bottom-2 bg-indigo-100 p-2 rounded-full cursor-pointer hover:bg-indigo-200">
143
+ <i class="fas fa-camera text-indigo-600"></i>
144
+ <input type="file" id="fileInput" accept="image/*" class="hidden">
145
+ </label>
146
+ </div>
147
+ <button type="submit" class="bg-indigo-600 text-white p-2 rounded-lg hover:bg-indigo-700 transition">
148
+ <i class="fas fa-paper-plane"></i>
149
+ </button>
150
+ </form>
151
+ </div>
152
+ </div>
153
+ </div>
154
+
155
+ <script>
156
+ // DOM Elements
157
+ const agent1Btn = document.getElementById('agent1Btn');
158
+ const agent2Btn = document.getElementById('agent2Btn');
159
+ const chatHeader = document.getElementById('chatHeader');
160
+ const agentTitle = document.getElementById('agentTitle');
161
+ const agentDescription = document.getElementById('agentDescription');
162
+ const agent1Icon = document.getElementById('agent1Icon');
163
+ const agent2Icon = document.getElementById('agent2Icon');
164
+ const messagesArea = document.getElementById('messagesArea');
165
+ const chatForm = document.getElementById('chatForm');
166
+ const messageInput = document.getElementById('messageInput');
167
+ const fileInput = document.getElementById('fileInput');
168
+ const imagePreviewContainer = document.getElementById('imagePreviewContainer');
169
+ const previewImage = document.getElementById('previewImage');
170
+ const fileName = document.getElementById('fileName');
171
+ const removeImageBtn = document.getElementById('removeImageBtn');
172
+ const typingIndicator = document.getElementById('typingIndicator');
173
+
174
+ // State
175
+ let currentAgent = 'agent1';
176
+ let selectedFile = null;
177
+
178
+ // Agent Switch
179
+ agent1Btn.addEventListener('click', () => {
180
+ currentAgent = 'agent1';
181
+ chatHeader.className = 'agent-1-bg p-4 flex items-center border-b';
182
+ agentTitle.textContent = 'Property Inspector';
183
+ agentDescription.textContent = 'Upload property images or describe issues for expert analysis';
184
+ agent1Icon.classList.remove('hidden');
185
+ agent2Icon.classList.add('hidden');
186
+ addMessage('agent', 'Switched to Property Inspector mode. You can upload images of property issues or describe them to me.');
187
+ });
188
+
189
+ agent2Btn.addEventListener('click', () => {
190
+ currentAgent = 'agent2';
191
+ chatHeader.className = 'agent-2-bg p-4 flex items-center border-b';
192
+ agentTitle.textContent = 'Tenancy FAQ';
193
+ agentDescription.textContent = 'Ask questions about tenancy laws, agreements, and rental processes';
194
+ agent1Icon.classList.add('hidden');
195
+ agent2Icon.classList.remove('hidden');
196
+ addMessage('agent', 'Switched to Tenancy FAQ mode. Ask me anything about rental agreements, tenant rights, or landlord responsibilities.');
197
+ });
198
+
199
+ // File Handling
200
+ fileInput.addEventListener('change', (e) => {
201
+ if (e.target.files.length > 0) {
202
+ selectedFile = e.target.files[0];
203
+ const reader = new FileReader();
204
+ reader.onload = (event) => {
205
+ previewImage.src = event.target.result;
206
+ fileName.textContent = selectedFile.name;
207
+ imagePreviewContainer.classList.remove('hidden');
208
+ };
209
+ reader.readAsDataURL(selectedFile);
210
+ }
211
+ });
212
+
213
+ removeImageBtn.addEventListener('click', () => {
214
+ selectedFile = null;
215
+ fileInput.value = '';
216
+ imagePreviewContainer.classList.add('hidden');
217
+ });
218
+
219
+ // Form Submission
220
+ chatForm.addEventListener('submit', (e) => {
221
+ e.preventDefault();
222
+ const message = messageInput.value.trim();
223
+
224
+ if (message || selectedFile) {
225
+ // Add user message
226
+ addMessage('user', message, selectedFile);
227
+
228
+ // Clear input
229
+ messageInput.value = '';
230
+ if (selectedFile) {
231
+ fileInput.value = '';
232
+ selectedFile = null;
233
+ imagePreviewContainer.classList.add('hidden');
234
+ }
235
+
236
+ // Show typing indicator
237
+ typingIndicator.classList.remove('hidden');
238
+
239
+ // Simulate agent response after delay
240
+ setTimeout(() => {
241
+ typingIndicator.classList.add('hidden');
242
+ generateAgentResponse(message);
243
+ }, 1500);
244
+ }
245
+ });
246
+
247
+ // Auto-resize textarea
248
+ messageInput.addEventListener('input', () => {
249
+ messageInput.style.height = 'auto';
250
+ messageInput.style.height = (messageInput.scrollHeight) + 'px';
251
+ });
252
+
253
+ // Add message to chat
254
+ function addMessage(sender, text, file = null) {
255
+ const messageDiv = document.createElement('div');
256
+ messageDiv.className = `flex ${sender === 'user' ? 'justify-end' : 'justify-start'}`;
257
+
258
+ const contentDiv = document.createElement('div');
259
+ contentDiv.className = `max-w-xs md:max-w-md lg:max-w-lg rounded-lg p-4 message-animation ${sender === 'user' ? 'bg-indigo-600 text-white' : currentAgent === 'agent1' ? 'bg-indigo-100 text-gray-800' : 'bg-purple-100 text-gray-800'}`;
260
+
261
+ if (file) {
262
+ const imgPreview = document.createElement('img');
263
+ imgPreview.src = URL.createObjectURL(file);
264
+ imgPreview.className = 'preview-image mb-2';
265
+ contentDiv.appendChild(imgPreview);
266
+ }
267
+
268
+ if (text) {
269
+ const textNode = document.createElement('p');
270
+ textNode.textContent = text;
271
+ contentDiv.appendChild(textNode);
272
+ }
273
+
274
+ messageDiv.appendChild(contentDiv);
275
+ messagesArea.appendChild(messageDiv);
276
+
277
+ // Scroll to bottom
278
+ messagesArea.scrollTop = messagesArea.scrollHeight;
279
+ }
280
+
281
+ // Generate agent response
282
+ function generateAgentResponse(userMessage) {
283
+ let response = '';
284
+
285
+ if (currentAgent === 'agent1') {
286
+ // Property Inspector responses
287
+ if (userMessage.toLowerCase().includes('wall') || userMessage.toLowerCase().includes('ceiling')) {
288
+ response = "It appears there is mould growth near the ceiling. This might be due to high humidity or a leak. I recommend checking for water seepage and using a dehumidifier.";
289
+ } else if (userMessage.toLowerCase().includes('floor') || userMessage.toLowerCase().includes('tile')) {
290
+ response = "I notice some cracked tiles in the flooring. This could be due to improper installation or structural movement. You might want to consult a flooring specialist to assess the damage.";
291
+ } else if (selectedFile) {
292
+ response = "From the image you've shared, I can identify several potential issues:\n1. Signs of water damage near the window frame\n2. Peeling paint indicating possible moisture problems\n3. A small crack in the corner that should be monitored\nWould you like more specific recommendations for any of these?";
293
+ } else if (userMessage.toLowerCase().includes('light') || userMessage.toLowerCase().includes('dark')) {
294
+ response = "The lighting appears insufficient in this area. Consider adding additional light fixtures or using higher wattage bulbs. For a more permanent solution, you might want to consult an electrician about installing new lighting points.";
295
+ } else {
296
+ response = "Thank you for sharing the information. To better assist you, could you provide more details about the issue you're observing? For example:\n- When did you first notice the problem?\n- Has it been getting worse over time?\n- Are there any specific areas of concern?";
297
+ }
298
+ } else {
299
+ // Tenancy FAQ responses
300
+ if (userMessage.toLowerCase().includes('notice') || userMessage.toLowerCase().includes('vacat')) {
301
+ response = "In most jurisdictions, tenants are required to give at least 30 days' notice before vacating a rental property. However, this can vary by location. Please let me know your city or region for more accurate information.";
302
+ } else if (userMessage.toLowerCase().includes('rent') || userMessage.toLowerCase().includes('increase')) {
303
+ response = "Generally, landlords cannot increase rent midway through a fixed-term lease unless the agreement specifically allows for it. For month-to-month tenancies, most areas require 30-60 days notice for rent increases. The exact rules depend on local tenancy laws.";
304
+ } else if (userMessage.toLowerCase().includes('deposit') || userMessage.toLowerCase().includes('security')) {
305
+ response = "If your landlord is not returning your deposit without valid reasons, you should:\n1. Send a formal written request\n2. Check your local tenancy board's procedures\n3. Consider filing a dispute if unresolved\nCould you specify your location for more tailored advice?";
306
+ } else if (userMessage.toLowerCase().includes('evict') || userMessage.toLowerCase().includes('remove')) {
307
+ response = "Landlords typically need valid reasons and proper notice to evict a tenant, except in cases of emergency (like non-payment or illegal activity). Common valid reasons include:\n- Non-payment of rent\n- Property damage\n- Lease violations\n- Owner moving in (in some areas)";
308
+ } else {
309
+ response = "I can help with questions about:\n- Rental agreements and contracts\n- Tenant rights and responsibilities\n- Security deposits\n- Rent increases\n- Repairs and maintenance obligations\n- Eviction processes\nWhat specific tenancy question can I answer for you?";
310
+ }
311
+ }
312
+
313
+ addMessage('agent', response);
314
+ }
315
+
316
+ // Initial welcome message
317
+ setTimeout(() => {
318
+ addMessage('agent', "I'm here to help with all your real estate questions. You can switch between Property Inspection and Tenancy FAQ modes using the buttons above. What would you like assistance with today?");
319
+ }, 500);
320
+ </script>
321
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=jhparmar/multi-agentic-real-estate-chatbot-image-text-based" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
322
+ </html>