capradeepgujaran commited on
Commit
469aa82
·
verified ·
1 Parent(s): 00759b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -51,7 +51,8 @@ def analyze_construction_image(images, video=None):
51
  results = []
52
 
53
  if images:
54
- for i, image in enumerate(images):
 
55
  image_data_url = f"data:image/png;base64,{encode_image(image)}"
56
  messages = [
57
  {
@@ -211,7 +212,7 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
211
 
212
  with gr.Row():
213
  with gr.Column(scale=1):
214
- image_input = gr.File(label="Upload Construction Site Images", file_count="multiple", type="file", elem_classes="image-container")
215
  video_input = gr.Video(label="Upload Construction Site Video", elem_classes="image-container")
216
  analyze_button = gr.Button("🔍 Analyze Safety Hazards", elem_classes="analyze-button")
217
  with gr.Column(scale=2):
 
51
  results = []
52
 
53
  if images:
54
+ for i, image_file in enumerate(images):
55
+ image = Image.open(image_file.name)
56
  image_data_url = f"data:image/png;base64,{encode_image(image)}"
57
  messages = [
58
  {
 
212
 
213
  with gr.Row():
214
  with gr.Column(scale=1):
215
+ image_input = gr.File(label="Upload Construction Site Images", file_count="multiple", type="filepath", elem_classes="image-container")
216
  video_input = gr.Video(label="Upload Construction Site Video", elem_classes="image-container")
217
  analyze_button = gr.Button("🔍 Analyze Safety Hazards", elem_classes="analyze-button")
218
  with gr.Column(scale=2):