capradeepgujaran
commited on
Commit
β’
fe52e0c
1
Parent(s):
1236fa7
Update app.py
Browse files
app.py
CHANGED
@@ -228,23 +228,22 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
|
|
228 |
"""
|
229 |
)
|
230 |
|
231 |
-
# First row: Upload Image
|
232 |
with gr.Row():
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
video_input = gr.Video(label="Upload Construction Site Video", elem_classes="image-container")
|
238 |
|
239 |
-
#
|
240 |
with gr.Row():
|
241 |
analyze_button = gr.Button("π Analyze Safety Hazards", elem_classes="analyze-button")
|
242 |
|
243 |
-
#
|
244 |
with gr.Row():
|
245 |
chatbot = gr.Chatbot(label="Safety Analysis Results and Expert Chat", elem_classes="chatbot")
|
246 |
|
247 |
-
#
|
248 |
with gr.Row():
|
249 |
msg = gr.Textbox(
|
250 |
label="Ask about safety measures or regulations",
|
@@ -253,13 +252,14 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
|
|
253 |
elem_classes="chat-input"
|
254 |
)
|
255 |
|
256 |
-
#
|
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 []
|
262 |
-
|
|
|
263 |
return history
|
264 |
|
265 |
analyze_button.click(
|
@@ -280,4 +280,4 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
|
|
280 |
|
281 |
# Launch the app
|
282 |
if __name__ == "__main__":
|
283 |
-
iface.launch(debug=True)
|
|
|
228 |
"""
|
229 |
)
|
230 |
|
231 |
+
# First row: Upload Image and Video side by side
|
232 |
with gr.Row():
|
233 |
+
with gr.Column(scale=1):
|
234 |
+
image_input = gr.File(label="Upload Construction Site Images", file_count="multiple", type="filepath", elem_classes="image-container")
|
235 |
+
with gr.Column(scale=1):
|
236 |
+
video_input = gr.Video(label="Upload Construction Site Video", elem_classes="image-container")
|
|
|
237 |
|
238 |
+
# Second row: Analyze Safety Hazards Button
|
239 |
with gr.Row():
|
240 |
analyze_button = gr.Button("π Analyze Safety Hazards", elem_classes="analyze-button")
|
241 |
|
242 |
+
# Third row: Chat Interface (Safety Analysis Results)
|
243 |
with gr.Row():
|
244 |
chatbot = gr.Chatbot(label="Safety Analysis Results and Expert Chat", elem_classes="chatbot")
|
245 |
|
246 |
+
# Fourth row: Question Bar
|
247 |
with gr.Row():
|
248 |
msg = gr.Textbox(
|
249 |
label="Ask about safety measures or regulations",
|
|
|
252 |
elem_classes="chat-input"
|
253 |
)
|
254 |
|
255 |
+
# Fifth row: Clear Chat Button
|
256 |
with gr.Row():
|
257 |
clear = gr.Button("ποΈ Clear", elem_classes="clear-button")
|
258 |
|
259 |
def update_chat(history, new_messages):
|
260 |
history = history or []
|
261 |
+
for title, content in new_messages:
|
262 |
+
history.append((None, f"{title}\n\n{content}"))
|
263 |
return history
|
264 |
|
265 |
analyze_button.click(
|
|
|
280 |
|
281 |
# Launch the app
|
282 |
if __name__ == "__main__":
|
283 |
+
iface.launch(debug=True, share=True)
|