Rammohan0504 commited on
Commit
74a72c4
·
verified ·
1 Parent(s): c4fefad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -24,9 +24,9 @@ def generate_captions(files):
24
 
25
  # Iterate through the uploaded images
26
  for file in files:
27
- # Open the image
28
- image = Image.open(file.name)
29
-
30
  if image.mode != "RGB":
31
  image = image.convert("RGB")
32
 
@@ -49,7 +49,7 @@ def generate_captions(files):
49
  # Gradio interface for uploading multiple files
50
  iface = gr.Interface(
51
  fn=generate_captions,
52
- inputs=gr.Files(type="file", label="Upload Site Photos"), # Allow batch upload of images
53
  outputs="text",
54
  title="Construction Site Image-to-Text Generator",
55
  description="Upload up to 10 site photos. The model will detect and describe construction activities and materials (e.g., concrete pouring, scaffolding, steel rods).",
 
24
 
25
  # Iterate through the uploaded images
26
  for file in files:
27
+ # Open the image from file path
28
+ image = Image.open(file.name) # Using file.name for filepath
29
+
30
  if image.mode != "RGB":
31
  image = image.convert("RGB")
32
 
 
49
  # Gradio interface for uploading multiple files
50
  iface = gr.Interface(
51
  fn=generate_captions,
52
+ inputs=gr.Files(type="filepath", label="Upload Site Photos"), # Handle batch upload of images
53
  outputs="text",
54
  title="Construction Site Image-to-Text Generator",
55
  description="Upload up to 10 site photos. The model will detect and describe construction activities and materials (e.g., concrete pouring, scaffolding, steel rods).",