Update app.py
Browse files
app.py
CHANGED
@@ -205,7 +205,7 @@ custom_css = """
|
|
205 |
text-overflow: ellipsis;
|
206 |
}
|
207 |
.image-container { border: 2px dashed #3498db; border-radius: 10px; padding: 1rem; text-align: center; margin-bottom: 1rem; }
|
208 |
-
.analyze-button { background-color: #2ecc71 !important; color: white !important;
|
209 |
.clear-button { background-color: #e74c3c !important; color: white !important; width: 100px !important; }
|
210 |
.chatbot { border: 1px solid #bdc3c7; border-radius: 10px; padding: 1rem; height: 500px; overflow-y: auto; }
|
211 |
.chat-input { border: 1px solid #bdc3c7; border-radius: 5px; padding: 0.5rem; width: 100%; }
|
@@ -228,25 +228,34 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
|
|
228 |
"""
|
229 |
)
|
230 |
|
|
|
231 |
with gr.Row():
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
|
251 |
def update_chat(history, new_messages):
|
252 |
history = history or []
|
|
|
205 |
text-overflow: ellipsis;
|
206 |
}
|
207 |
.image-container { border: 2px dashed #3498db; border-radius: 10px; padding: 1rem; text-align: center; margin-bottom: 1rem; }
|
208 |
+
.analyze-button { background-color: #2ecc71 !important; color: white !important; width: 100%; }
|
209 |
.clear-button { background-color: #e74c3c !important; color: white !important; width: 100px !important; }
|
210 |
.chatbot { border: 1px solid #bdc3c7; border-radius: 10px; padding: 1rem; height: 500px; overflow-y: auto; }
|
211 |
.chat-input { border: 1px solid #bdc3c7; border-radius: 5px; padding: 0.5rem; width: 100%; }
|
|
|
228 |
"""
|
229 |
)
|
230 |
|
231 |
+
# First row: Upload Image
|
232 |
with gr.Row():
|
233 |
+
image_input = gr.File(label="Upload Construction Site Images", file_count="multiple", type="filepath", elem_classes="image-container")
|
234 |
+
|
235 |
+
# Second row: Upload Video
|
236 |
+
with gr.Row():
|
237 |
+
video_input = gr.Video(label="Upload Construction Site Video", elem_classes="image-container")
|
238 |
+
|
239 |
+
# Third row: Analyze Safety Hazards Button
|
240 |
+
with gr.Row():
|
241 |
+
analyze_button = gr.Button("🔍 Analyze Safety Hazards", elem_classes="analyze-button")
|
242 |
+
|
243 |
+
# Fourth row: Chat Interface (Safety Analysis Results)
|
244 |
+
with gr.Row():
|
245 |
+
chatbot = gr.Chatbot(label="Safety Analysis Results and Expert Chat", elem_classes="chatbot")
|
246 |
+
|
247 |
+
# Fifth row: Question Bar
|
248 |
+
with gr.Row():
|
249 |
+
msg = gr.Textbox(
|
250 |
+
label="Ask about safety measures or regulations",
|
251 |
+
placeholder="E.g., 'What OSHA guidelines apply to this hazard?'",
|
252 |
+
show_label=False,
|
253 |
+
elem_classes="chat-input"
|
254 |
+
)
|
255 |
+
|
256 |
+
# Sixth row: Clear Chat Button
|
257 |
+
with gr.Row():
|
258 |
+
clear = gr.Button("🗑️ Clear", elem_classes="clear-button")
|
259 |
|
260 |
def update_chat(history, new_messages):
|
261 |
history = history or []
|