Download app/testing.py from ShadowTEM/Chatbot: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/ShadowTEM/Chatbot/resolve/main/app/testing.py
- Command line
-
hf download hf://spaces/ShadowTEM/Chatbot/app/testing.py
-
curl -L -o testing.py https://huggingface.co/spaces/ShadowTEM/Chatbot/resolve/main/app/testing.py
1.46 kB
| import numpy as np | |
| import pandas as pd | |
| import tensorflow as tf | |
| import matplotlib.pyplot as plt | |
| import seaborn as sb | |
| import splitfolders | |
| import cv2 | |
| import random | |
| from keras.models import Sequential | |
| from keras.layers import Conv2D, MaxPooling2D, Dropout, Flatten, Dense, BatchNormalization | |
| from tensorflow.keras.utils import plot_model | |
| from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay, classification_report, accuracy_score | |
| from sklearn.utils.class_weight import compute_class_weight | |
| from imutils import paths | |
| from keras.applications import VGG16 | |
| from keras.applications import ResNet50 | |
| from keras.applications import DenseNet121 | |
| from tensorflow.keras.preprocessing.image import ImageDataGenerator | |
| import os | |
| from tensorflow.keras.callbacks import ModelCheckpoint | |
| import shutil | |
| # ---------------------------- | |
| # Global Variables & Constants | |
| # ---------------------------- | |
| IMGSIZE = 224 | |
| BATCH_SIZE = 64 | |
| classes = ['Normal', 'Cyst', 'Tumor', 'Stone'] | |
| inputFolder = '/content/CT-KIDNEY-DATASET-Normal-Cyst-Tumor-Stone/CT-KIDNEY-DATASET-Normal-Cyst-Tumor-Stone' | |
| outputFolder = '/content/CT_dataset' | |
| class_to_index = {cls: i for i, cls in enumerate(classes)} | |
| # ---------------------------- | |
| # Dataset Split (using splitfolders) | |
| # ---------------------------- | |
| splitfolders.ratio(inputFolder, outputFolder, seed=42, ratio=(0.7, 0.15, 0.15)) | |
| imgPaths = list(paths.list_images(outputFolder)) | |
| random.shuffle(imgPaths) |