alicelouis commited on
Commit
55d7045
·
1 Parent(s): 8af208d

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -329,39 +329,39 @@ elif tabs == 'Upload': #and count_system () != 1:
329
  list_to_be_sorted.append(dic)
330
  data_base.append(y)
331
  if list_to_be_sorted[0]['name'] == "adenocarcinoma":
332
- dff_image.save(r".\Adenocarcinoma\{}".format(name_of_files_new[i]))
333
  image_path = name_of_files_new[i]
334
- with Image.open(r".\Adenocarcinoma\{}".format(image_path)) as image:
335
  width, height = image.size
336
  new_width = 2 * width // 3
337
  cropped_image = image.crop((0, 0, new_width, height))
338
- cropped_image.save(r".\Adenocarcinoma\{}".format(image_path))
339
  elif list_to_be_sorted[0]['name'] == "large.cell":
340
- dff_image.save(r".\Large cell carcinoma\{}".format(name_of_files_new[i]))
341
  image_path = name_of_files_new[i]
342
- with Image.open(r".\Large cell carcinoma\{}".format(image_path)) as image:
343
  width, height = image.size
344
  new_width = 2 * width // 3
345
  cropped_image = image.crop((0, 0, new_width, height))
346
- cropped_image.save(r".\Large cell carcinoma\{}".format(image_path))
347
  #dff_image.save(r".\Large cell carcinoma\{}".format(name_of_files_new[i]))
348
  elif list_to_be_sorted[0]['name'] == "normal":
349
- dff_image.save(r".\Normal\{}".format(name_of_files_new[i]))
350
  image_path = name_of_files_new[i]
351
- with Image.open(r".\Normal\{}".format(image_path)) as image:
352
  width, height = image.size
353
  new_width = 2 * width // 3
354
  cropped_image = image.crop((0, 0, new_width, height))
355
- cropped_image.save(r".\Normal\{}".format(image_path))
356
  #dff_image.save(r".\Normal\{}".format(name_of_files_new[i]))
357
  elif list_to_be_sorted[0]['name'] == "squamous.cell":
358
- dff_image.save(r".\Squamous cell carcinoma\{}".format(name_of_files_new[i]))
359
  image_path = name_of_files_new[i]
360
- with Image.open(r".\Squamous cell carcinoma\{}".format(image_path)) as image:
361
  width, height = image.size
362
  new_width = 2 * width // 3
363
  cropped_image = image.crop((0, 0, new_width, height))
364
- cropped_image.save(r".\Squamous cell carcinoma\{}".format(image_path))
365
  #dff_image.save(r".\Squamous cell carcinoma\{}".format(name_of_files_new[i]))
366
  # st.image(dff_image, use_column_width=True)
367
  # st.image(gradcam_image, use_column_width=True)
 
329
  list_to_be_sorted.append(dic)
330
  data_base.append(y)
331
  if list_to_be_sorted[0]['name'] == "adenocarcinoma":
332
+ dff_image.save(r"./Adenocarcinoma/{}".format(name_of_files_new[i]))
333
  image_path = name_of_files_new[i]
334
+ with Image.open(r"./Adenocarcinoma/{}".format(image_path)) as image:
335
  width, height = image.size
336
  new_width = 2 * width // 3
337
  cropped_image = image.crop((0, 0, new_width, height))
338
+ cropped_image.save(r"./Adenocarcinoma/{}".format(image_path))
339
  elif list_to_be_sorted[0]['name'] == "large.cell":
340
+ dff_image.save(r"./Large cell carcinoma/{}".format(name_of_files_new[i]))
341
  image_path = name_of_files_new[i]
342
+ with Image.open(r"./Large cell carcinoma/{}".format(image_path)) as image:
343
  width, height = image.size
344
  new_width = 2 * width // 3
345
  cropped_image = image.crop((0, 0, new_width, height))
346
+ cropped_image.save(r"./Large cell carcinoma/{}".format(image_path))
347
  #dff_image.save(r".\Large cell carcinoma\{}".format(name_of_files_new[i]))
348
  elif list_to_be_sorted[0]['name'] == "normal":
349
+ dff_image.save(r"./Normal/{}".format(name_of_files_new[i]))
350
  image_path = name_of_files_new[i]
351
+ with Image.open(r"./Normal/{}".format(image_path)) as image:
352
  width, height = image.size
353
  new_width = 2 * width // 3
354
  cropped_image = image.crop((0, 0, new_width, height))
355
+ cropped_image.save(r"./Normal/{}".format(image_path))
356
  #dff_image.save(r".\Normal\{}".format(name_of_files_new[i]))
357
  elif list_to_be_sorted[0]['name'] == "squamous.cell":
358
+ dff_image.save(r"./Squamous cell carcinoma/{}".format(name_of_files_new[i]))
359
  image_path = name_of_files_new[i]
360
+ with Image.open(r"./Squamous cell carcinoma/{}".format(image_path)) as image:
361
  width, height = image.size
362
  new_width = 2 * width // 3
363
  cropped_image = image.crop((0, 0, new_width, height))
364
+ cropped_image.save(r"./Squamous cell carcinoma/{}".format(image_path))
365
  #dff_image.save(r".\Squamous cell carcinoma\{}".format(name_of_files_new[i]))
366
  # st.image(dff_image, use_column_width=True)
367
  # st.image(gradcam_image, use_column_width=True)