Spaces:
Runtime error
Runtime error
Commit
·
7dcf763
1
Parent(s):
1000be6
Upload app.py
Browse files
app.py
CHANGED
@@ -301,7 +301,7 @@ elif tabs == 'Upload': #and count_system () != 1:
|
|
301 |
]
|
302 |
target_layer_dff = model.beit.layernorm
|
303 |
target_layer_gradcam = model.beit.encoder.layer[-2].output
|
304 |
-
image_resized = image
|
305 |
tensor_resized = transforms.ToTensor()(image_resized)
|
306 |
outputs = model(**inputs)
|
307 |
logits = outputs.logits
|
@@ -328,7 +328,7 @@ elif tabs == 'Upload': #and count_system () != 1:
|
|
328 |
dic["name"] = x
|
329 |
list_to_be_sorted.append(dic)
|
330 |
data_base.append(y)
|
331 |
-
|
332 |
if list_to_be_sorted[0]['name'] == "adenocarcinoma":
|
333 |
dff_image.save(r"./Adenocarcinoma/{}".format(name_of_files_new[i]))
|
334 |
image_path = name_of_files_new[i]
|
@@ -379,7 +379,7 @@ elif tabs == 'Upload': #and count_system () != 1:
|
|
379 |
with col1:
|
380 |
st.markdown("<h2 style='text-align: center; border: 2px solid #5370c6; border-radius: 5px; padding: 15px; background-color: white; color: black;' > Adenocarcinoma </h2>".format(centered_style), unsafe_allow_html=True)
|
381 |
# Add the second subheader to the second column
|
382 |
-
folder_path = r"./Adenocarcinoma"
|
383 |
image_files = [f for f in os.listdir(folder_path) if f.endswith('.png') or f.endswith('.jpg')]
|
384 |
# Display the images in a loop
|
385 |
for i in range(0, len(image_files), 2):
|
@@ -398,7 +398,7 @@ elif tabs == 'Upload': #and count_system () != 1:
|
|
398 |
count_classes.append("Adeno")
|
399 |
with col2:
|
400 |
st.markdown("<h2 style='text-align: center; border: 2px solid green; border-radius: 5px; padding: 15px; background-color: white; color: black;' > Normal </h2>".format(centered_style), unsafe_allow_html=True)
|
401 |
-
folder_path = r"./Normal"
|
402 |
image_files = [f for f in os.listdir(folder_path) if f.endswith('.png') or f.endswith('.jpg')]
|
403 |
# Display the images in a loop
|
404 |
for i in range(0, len(image_files), 2):
|
@@ -422,7 +422,7 @@ elif tabs == 'Upload': #and count_system () != 1:
|
|
422 |
|
423 |
with col5:
|
424 |
st.markdown("<h2 style='text-align: center; border: 2px solid orange; border-radius: 5px; padding: 15px; background-color: white; color: black;' > Large cell carcinoma </h2>".format(centered_style), unsafe_allow_html=True)
|
425 |
-
folder_path = r"./Large cell carcinoma"
|
426 |
image_files = [f for f in os.listdir(folder_path) if f.endswith('.png') or f.endswith('.jpg')]
|
427 |
# Display the images in a loop
|
428 |
for i in range(0, len(image_files), 2):
|
@@ -441,7 +441,7 @@ elif tabs == 'Upload': #and count_system () != 1:
|
|
441 |
count_classes.append("Large")
|
442 |
with col6:
|
443 |
st.markdown("<h2 style='text-align: center; border: 2px solid #f16565; border-radius: 5px; padding: 15px; background-color: white; color: black;' > Squamous cell carcinoma </h2>".format(centered_style), unsafe_allow_html=True)
|
444 |
-
folder_path = r"./Squamous cell carcinoma"
|
445 |
image_files = [f for f in os.listdir(folder_path) if f.endswith('.png') or f.endswith('.jpg')]
|
446 |
# Display the images in a loop
|
447 |
for i in range(0, len(image_files), 2):
|
|
|
301 |
]
|
302 |
target_layer_dff = model.beit.layernorm
|
303 |
target_layer_gradcam = model.beit.encoder.layer[-2].output
|
304 |
+
image_resized = image
|
305 |
tensor_resized = transforms.ToTensor()(image_resized)
|
306 |
outputs = model(**inputs)
|
307 |
logits = outputs.logits
|
|
|
328 |
dic["name"] = x
|
329 |
list_to_be_sorted.append(dic)
|
330 |
data_base.append(y)
|
331 |
+
|
332 |
if list_to_be_sorted[0]['name'] == "adenocarcinoma":
|
333 |
dff_image.save(r"./Adenocarcinoma/{}".format(name_of_files_new[i]))
|
334 |
image_path = name_of_files_new[i]
|
|
|
379 |
with col1:
|
380 |
st.markdown("<h2 style='text-align: center; border: 2px solid #5370c6; border-radius: 5px; padding: 15px; background-color: white; color: black;' > Adenocarcinoma </h2>".format(centered_style), unsafe_allow_html=True)
|
381 |
# Add the second subheader to the second column
|
382 |
+
folder_path = r"./Adenocarcinoma/"
|
383 |
image_files = [f for f in os.listdir(folder_path) if f.endswith('.png') or f.endswith('.jpg')]
|
384 |
# Display the images in a loop
|
385 |
for i in range(0, len(image_files), 2):
|
|
|
398 |
count_classes.append("Adeno")
|
399 |
with col2:
|
400 |
st.markdown("<h2 style='text-align: center; border: 2px solid green; border-radius: 5px; padding: 15px; background-color: white; color: black;' > Normal </h2>".format(centered_style), unsafe_allow_html=True)
|
401 |
+
folder_path = r"./Normal/"
|
402 |
image_files = [f for f in os.listdir(folder_path) if f.endswith('.png') or f.endswith('.jpg')]
|
403 |
# Display the images in a loop
|
404 |
for i in range(0, len(image_files), 2):
|
|
|
422 |
|
423 |
with col5:
|
424 |
st.markdown("<h2 style='text-align: center; border: 2px solid orange; border-radius: 5px; padding: 15px; background-color: white; color: black;' > Large cell carcinoma </h2>".format(centered_style), unsafe_allow_html=True)
|
425 |
+
folder_path = r"./Large cell carcinoma/"
|
426 |
image_files = [f for f in os.listdir(folder_path) if f.endswith('.png') or f.endswith('.jpg')]
|
427 |
# Display the images in a loop
|
428 |
for i in range(0, len(image_files), 2):
|
|
|
441 |
count_classes.append("Large")
|
442 |
with col6:
|
443 |
st.markdown("<h2 style='text-align: center; border: 2px solid #f16565; border-radius: 5px; padding: 15px; background-color: white; color: black;' > Squamous cell carcinoma </h2>".format(centered_style), unsafe_allow_html=True)
|
444 |
+
folder_path = r"./Squamous cell carcinoma/"
|
445 |
image_files = [f for f in os.listdir(folder_path) if f.endswith('.png') or f.endswith('.jpg')]
|
446 |
# Display the images in a loop
|
447 |
for i in range(0, len(image_files), 2):
|