shukdevdatta123 commited on
Commit
f6f137b
·
verified ·
1 Parent(s): 5b33cad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -120,17 +120,14 @@ if upload_option == "Single Image Upload":
120
  with open(image_path, "wb") as f:
121
  f.write(uploaded_image.getbuffer())
122
 
123
- # Process the image through the pipeline
124
- output = pipeline.invoke({"image_path": image_path})
 
 
125
 
126
- # Show the results in a user-friendly format
127
- st.subheader("Extracted Vehicle Information")
128
- st.json(output)
129
-
130
- # Optionally, display more vehicle images from the folder
131
- img_dir = "/content/images"
132
- image_paths = glob.glob(os.path.join(img_dir, "*.*"))
133
- display_image_grid(image_paths)
134
 
135
  # Batch Images Upload
136
  elif upload_option == "Batch Images Upload":
@@ -143,10 +140,12 @@ elif upload_option == "Batch Images Upload":
143
  with open(f"/tmp/{file.name}", "wb") as f:
144
  f.write(file.getbuffer())
145
 
146
- # Process the batch and display the results in a DataFrame
147
- batch_output = pipeline.batch(batch_input)
148
- df = pd.DataFrame(batch_output)
149
- st.dataframe(df)
 
 
150
 
151
  # Show images in a grid
152
  image_paths = [f"/tmp/{file.name}" for file in batch_images]
 
120
  with open(image_path, "wb") as f:
121
  f.write(uploaded_image.getbuffer())
122
 
123
+ # Add button to trigger information extraction
124
+ if st.button("Extract Vehicle Information"):
125
+ # Process the image through the pipeline
126
+ output = pipeline.invoke({"image_path": image_path})
127
 
128
+ # Show the results in a user-friendly format
129
+ st.subheader("Extracted Vehicle Information")
130
+ st.json(output)
 
 
 
 
 
131
 
132
  # Batch Images Upload
133
  elif upload_option == "Batch Images Upload":
 
140
  with open(f"/tmp/{file.name}", "wb") as f:
141
  f.write(file.getbuffer())
142
 
143
+ # Add button to trigger batch information extraction
144
+ if st.button("Extract Vehicle Information from Batch"):
145
+ # Process the batch and display the results in a DataFrame
146
+ batch_output = pipeline.batch(batch_input)
147
+ df = pd.DataFrame(batch_output)
148
+ st.dataframe(df)
149
 
150
  # Show images in a grid
151
  image_paths = [f"/tmp/{file.name}" for file in batch_images]