This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get directory function in get images file | |
def get_directory(url): | |
return "URL_" + str(url.replace("/","_")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing the required libaries | |
from flask import Flask, render_template, request, redirect, url_for | |
from get_images import get_images, get_path, get_directory | |
from get_prediction import get_prediction | |
from generate_html import generate_html | |
from torchvision import models | |
import json | |
app = Flask(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing required libraries | |
import requests | |
from bs4 import BeautifulSoup | |
import os | |
import time | |
def get_path(url): | |
return "static/URL_" + str(url.replace("/","_")) | |
headers = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing the required libraries | |
import json | |
import io | |
import glob | |
from PIL import Image | |
from torchvision import models | |
import torchvision.transforms as transforms | |
# Pass the parameter "pretrained" as "True" to use the pretrained weights: | |
model = models.densenet121(pretrained=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load model | |
dt_model = classification.load_model(model_name='decision_tree_1') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# save the model | |
classification.save_model(classification_dt, 'decision_tree_1') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# read the test data | |
test_data_classification = pd.read_csv('datasets/loan_test_data.csv') | |
# make predictions | |
predictions = classification.predict_model(classification_dt, data=test_data_classification) | |
# view the predictions | |
predictions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# interpret model : Correlation | |
classification.interpret_model(classification_xgb,plot='correlation') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# interpret_model: SHAP | |
classification.interpret_model(classification_xgb) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# evaluate model | |
classification.evaluate_model(classification_dt) |