xtlyxt commited on
Commit
a63244f
·
verified ·
1 Parent(s): dee92a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -133,23 +133,27 @@ if st.button("Generate HeatMap & DataFrame"):
133
  worksheet = writer.sheets['Sheet1']
134
 
135
  # Set the column width and row height
136
- worksheet.set_column('A:I', 20) # Set width for columns A-I
137
- worksheet.set_column('J:J', 30) # Set width for column J (Image View)
138
- worksheet.set_column('K:K', 15) # Set width for column K (Image Num)
 
 
 
 
139
  for row_num in range(len(df_emotions) + 1): # +1 to include the header row
140
- worksheet.set_row(row_num, 38) # Set the row height to 38
141
 
142
  # Iterate over the images and insert them into the 'Image View' column
143
  for idx, image in enumerate(selected_images):
144
  # Convert the image to a format that can be inserted into Excel
145
  image_stream = io.BytesIO()
146
- image.save(image_stream, format='PNG')
147
  image_stream.seek(0)
148
  # Calculate the scaling factor to fit the image inside the cell
149
  cell_width = 64
150
  scale_factor = cell_width / image.width
151
  # Insert the image into the cell
152
- worksheet.insert_image(f'J{idx + 2}', 'image.png', {
153
  'image_data': image_stream,
154
  'x_scale': scale_factor,
155
  'y_scale': scale_factor,
 
133
  worksheet = writer.sheets['Sheet1']
134
 
135
  # Set the column width and row height
136
+ worksheet.set_column('A:G', 8) # Set width for columns A-G
137
+ worksheet.set_column('H:H', 22) # Set width for column H (Image Name)
138
+ worksheet.set_column('I:I', 14) # Set width for column I (Image Size)
139
+ worksheet.set_column('J:J', 12) # Set width for column J (Image View)
140
+ worksheet.set_column('K:K', 12) # Set width for column K (Image Num)
141
+
142
+
143
  for row_num in range(len(df_emotions) + 1): # +1 to include the header row
144
+ worksheet.set_row(row_num, 48) # Set the row height to 38
145
 
146
  # Iterate over the images and insert them into the 'Image View' column
147
  for idx, image in enumerate(selected_images):
148
  # Convert the image to a format that can be inserted into Excel
149
  image_stream = io.BytesIO()
150
+ image.save(image_stream, format='JPG')
151
  image_stream.seek(0)
152
  # Calculate the scaling factor to fit the image inside the cell
153
  cell_width = 64
154
  scale_factor = cell_width / image.width
155
  # Insert the image into the cell
156
+ worksheet.insert_image(f'J{idx + 2}', 'image.jpg', {
157
  'image_data': image_stream,
158
  'x_scale': scale_factor,
159
  'y_scale': scale_factor,