capradeepgujaran commited on
Commit
e37b756
·
verified ·
1 Parent(s): 5a74233

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -19
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; margin-top: 10px; 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,25 +228,34 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
228
  """
229
  )
230
 
 
231
  with gr.Row():
232
- # Input section
233
- with gr.Column(scale=1, min_width=300): # Adjust width of input column
234
- image_input = gr.File(label="Upload Construction Site Images", file_count="multiple", type="filepath", elem_classes="image-container")
235
- video_input = gr.Video(label="Upload Construction Site Video", elem_classes="image-container")
236
- analyze_button = gr.Button("🔍 Analyze Safety Hazards", elem_classes="analyze-button")
237
-
238
- # Chat output section
239
- with gr.Column(scale=2): # Larger scale for the chat output section
240
- with gr.Group(elem_classes="chat-container"):
241
- chatbot = gr.Chatbot(label="Safety Analysis Results and Expert Chat", elem_classes="chatbot")
242
- with gr.Row(elem_classes="input-row"):
243
- msg = gr.Textbox(
244
- label="Ask about safety measures or regulations",
245
- placeholder="E.g., 'What OSHA guidelines apply to this hazard?'",
246
- show_label=False,
247
- elem_classes="chat-input"
248
- )
249
- clear = gr.Button("🗑️ Clear", elem_classes="clear-button")
 
 
 
 
 
 
 
 
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 []