capradeepgujaran commited on
Commit
fe52e0c
β€’
1 Parent(s): 1236fa7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
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
- 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",
@@ -253,13 +252,14 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
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 []
262
- history.extend(new_messages)
 
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)