neerajkalyank commited on
Commit
2ac9f93
·
verified ·
1 Parent(s): ad14f97

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +223 -0
app.py ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # List of apps with added Google Drive input links
4
+ apps = [
5
+ {
6
+ "name": "Auto DPR Generator",
7
+ "url": "https://huggingface.co/spaces/Rammohan0504/DPR-5",
8
+ "description": "Generates detailed progress reports based on uploaded site images, streamlining documentation.",
9
+ "input": "inputs DPR",
10
+ "drive_url": "https://drive.google.com/drive/folders/1w3FHuP6HOlKDur_r5lcnM8iXqBKdFors?usp=sharing"
11
+ },
12
+ {
13
+ "name": "AI Based Work Progress Verifier",
14
+ "url": "https://huggingface.co/spaces/Rekham1110/Construction_Project1",
15
+ "description": "Automatically detects construction milestones from site images and updates Salesforce with completion percentages and tags.",
16
+ "input": "Work Progress Verifier",
17
+ "drive_url": "https://drive.google.com/drive/folders/106UNEiyLKQu1aZfTFyXACdYY-_BYJlEg?usp=sharing"
18
+ },
19
+ {
20
+ "name": "Safety Violation CCTV AI Full",
21
+ "url": "https://huggingface.co/spaces/PrashanthB461/Safety_Violation_CCTV_AI",
22
+ "description": "Real-time detection of safety violations like missing helmets or unauthorized access, with alerts via Salesforce dashboard.",
23
+ "input": "Safety Violation",
24
+ "drive_url": "https://drive.google.com/drive/folders/1SfJWnUPU7lxSkPrAYiu4bqRFFl-cvChs?usp=sharing"
25
+ },
26
+ {
27
+ "name": "Material Reconciliation",
28
+ "url": "https://huggingface.co/spaces/VijayPulmamidi/MaterialReconciliationAI",
29
+ "description": "Tracks materials from purchase to usage, preventing waste, theft, or mismanagement.",
30
+ "input": "materialreconciliation",
31
+ "drive_url": "https://drive.google.com/drive/folders/1CFOC32FqxPhjLMUdPzUjH76uVSvtnbHL?usp=sharing"
32
+ },
33
+ {
34
+ "name": "Material Estimator",
35
+ "url": "https://kushalmanda-yolov5-blueprint-analysis.hf.space",
36
+ "description": "Provides accurate material estimations for construction projects based on blueprints and inputs.",
37
+ "input": "material estimator",
38
+ "drive_url": "https://drive.google.com/drive/folders/1WMWiqk7sw5Nn7YE9m0TFWcEvMY5Bje-A?usp=sharing"
39
+ },
40
+ {
41
+ "name": "AI Coach Site Supervisor",
42
+ "url": "https://huggingface.co/spaces/geethareddy/geethaAICoach3",
43
+ "description": "Generates daily checklists, milestone-based focus suggestions, and reflection logs for site supervisors.",
44
+ "input": "AI Coach Site Supervisor",
45
+ "drive_url": "https://drive.google.com/drive/folders/1M_IvEL3eezcIGlDMwOeyMubPIYOeWSGm?usp=sharing"
46
+ },
47
+ {
48
+ "name": "Smart Finishing Material Estimator",
49
+ "url": "https://huggingface.co/spaces/himabindug212/estimation_material",
50
+ "description": "Estimates quantities of finishing materials like tiles, paint, and panels with auto-calculated results.",
51
+ "input": "Smart Finisher Material Estimator",
52
+ "drive_url": "https://drive.google.com/drive/folders/167c5Ej-O1Hcl0UdXMmlMAbzrOOwllWnc?usp=sharing"
53
+ },
54
+ {
55
+ "name": "Labour Attendance Analyzer",
56
+ "url": "https://huggingface.co/spaces/lavanya121/attendance-forecasting_121",
57
+ "description": "Monitors labour attendance, identifies shortage risks, and suggests actionable solutions.",
58
+ "input": "Labour Attendance",
59
+ "drive_url": "https://drive.google.com/drive/folders/1sanCj7li9wGlX_VPJmIjdpPyOR-WQrmX?usp=sharing"
60
+ },
61
+ {
62
+ "name": "AI Estimator Daily Requirements",
63
+ "url": "https://huggingface.co/spaces/Naveensai/Construction-Forecast-App",
64
+ "description": "Forecasts daily labour and material requirements for efficient construction site management.",
65
+ "input": "AI Estimator Daily Requirements",
66
+ "drive_url": "https://drive.google.com/drive/folders/1fe3Bu0cPjMCTsQDaqBRI7TkqSs9105zP?usp=sharing"
67
+ },
68
+ ]
69
+
70
+ # Function to generate HTML content
71
+ def display_apps(search_query="", filter_input="All"):
72
+ # Filter apps based on search query and input category
73
+ filtered_apps = apps
74
+ if search_query:
75
+ filtered_apps = [
76
+ app for app in filtered_apps
77
+ if search_query.lower() in app["name"].lower() or search_query.lower() in app["input"].lower()
78
+ ]
79
+ if filter_input != "All":
80
+ filtered_apps = [app for app in filtered_apps if app["input"] == filter_input]
81
+
82
+ # Generate HTML with embedded CSS and JavaScript
83
+ html_content = """
84
+ <!DOCTYPE html>
85
+ <html lang="en">
86
+ <head>
87
+ <meta charset="UTF-8">
88
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
89
+ <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
90
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
91
+ <style>
92
+ body {
93
+ font-family: 'Inter', sans-serif;
94
+ background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
95
+ }
96
+ .card {
97
+ transition: transform 0.3s ease, box-shadow 0.3s ease;
98
+ margin-bottom: 20px;
99
+ }
100
+ .card:hover {
101
+ transform: translateY(-5px);
102
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
103
+ }
104
+ .search-input, .filter-select {
105
+ transition: border-color 0.3s ease, box-shadow 0.3s ease;
106
+ }
107
+ .search-input:focus, .filter-select:focus {
108
+ border-color: #2563eb;
109
+ box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
110
+ }
111
+ .header {
112
+ animation: fadeIn 1s ease-in-out;
113
+ }
114
+ @keyframes fadeIn {
115
+ from { opacity: 0; transform: translateY(-20px); }
116
+ to { opacity: 1; transform: translateY(0); }
117
+ }
118
+ .button-container {
119
+ display: flex;
120
+ justify-content: center;
121
+ gap: 10px;
122
+ }
123
+ .launch-button, .drive-button {
124
+ background-color: transparent;
125
+ color: #2563eb;
126
+ border: 1px solid #2563eb;
127
+ padding: 5px 15px;
128
+ border-radius: 5px;
129
+ text-decoration: none;
130
+ transition: color 0.3s ease, border-color 0.3s ease;
131
+ }
132
+ .launch-button:hover, .drive-button:hover {
133
+ color: #1d4ed8;
134
+ border-color: #1d4ed8;
135
+ }
136
+ </style>
137
+ </head>
138
+ <body>
139
+ <div class="min-h-screen py-12 px-4 sm:px-6 lg:px-8">
140
+ <div class="max-w-7xl mx-auto">
141
+ <div class="text-center mb-12 header">
142
+ <h1 class="text-4xl font-bold text-gray-900">SMARTLAB APPS</h1>
143
+ </div>
144
+ <div id="apps-grid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
145
+ """
146
+
147
+ for app in filtered_apps:
148
+ html_content += f"""
149
+ <div class="card bg-white rounded-xl shadow-lg p-6">
150
+ <h2 class="text-xl font-semibold text-blue-600 mb-3">{app['name']}</h2>
151
+ <p class="text-gray-600 mb-4">{app['description']}</p>
152
+ <p class="text-gray-500 italic mb-4"><span class="font-medium">Category:</span> {app['input']}</p>
153
+ <div class="button-container">
154
+ <a href="{app['url']}" target="_blank" class="launch-button">
155
+ Launch App
156
+ </a>
157
+ <a href="{app['drive_url']}" target="_blank" class="drive-button">
158
+ View Input Data
159
+ </a>
160
+ </div>
161
+ </div>
162
+ """
163
+
164
+ html_content += """
165
+ </div>
166
+ </div>
167
+ </div>
168
+ <script>
169
+ document.addEventListener('DOMContentLoaded', () => {
170
+ const searchInput = document.getElementById('search-input');
171
+ const filterInput = document.getElementById('filter-input');
172
+ const appsGrid = document.getElementById('apps-grid');
173
+
174
+ function renderApps() {
175
+ const searchQuery = searchInput ? searchInput.value.toLowerCase() : '';
176
+ const filterValue = filterInput ? filterInput.value : 'All';
177
+ let filteredApps = """ + str(apps).replace("'", '"') + """;
178
+
179
+ if (searchQuery) {
180
+ filteredApps = filteredApps.filter(app =>
181
+ app.name.toLowerCase().includes(searchQuery) ||
182
+ app.input.toLowerCase().includes(searchQuery)
183
+ );
184
+ }
185
+
186
+ if (filterValue !== "All") {
187
+ filteredApps = filteredApps.filter(app => app.input === filterValue);
188
+ }
189
+
190
+ appsGrid.innerHTML = filteredApps.length ? filteredApps.map(app => `
191
+ <div class="card bg-white rounded-xl shadow-lg p-6">
192
+ <h2 class="text-xl font-semibold text-blue-600 mb-3">\${app.name}</h2>
193
+ <p class="text-gray-600 mb-4">\${app.description}</p>
194
+ <p class="text-gray-500 italic mb-4"><span class="font-medium">Category:</span> \${app.input}</p>
195
+ <div class="button-container">
196
+ <a href="\${app.url}" target="_blank" class="launch-button">
197
+ Launch App
198
+ </a>
199
+ <a href="\${app.drive_url}" target="_blank" class="drive-button">
200
+ View Input Data
201
+ </a>
202
+ </div>
203
+ </div>
204
+ `).join('') : '<p class="text-center text-gray-600 col-span-full">No apps found matching your criteria.</p>';
205
+ }
206
+
207
+ if (searchInput && filterInput) {
208
+ searchInput.addEventListener('input', renderApps);
209
+ filterInput.addEventListener('change', renderApps);
210
+ renderApps();
211
+ }
212
+ });
213
+ </script>
214
+ </body>
215
+ </html>
216
+ """
217
+
218
+ return html_content
219
+
220
+ # Gradio interface
221
+ with gr.Blocks(title="SMARTLAB APPS") as demo:
222
+ output = gr.HTML(display_apps("", "All"))
223
+ demo.launch()