Update app.py
Browse files
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 |
-
#
|
124 |
-
|
|
|
|
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
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 |
-
#
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
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]
|