Skip to content

Instantly share code, notes, and snippets.

View AjinkyaChavan9's full-sized avatar

Ajinkya Chavan AjinkyaChavan9

View GitHub Profile
@AjinkyaChavan9
AjinkyaChavan9 / download_coursera_jupyter_data.md
Last active October 5, 2020 21:21 — forked from msis/download_coursera_jupyter_data.md
[How to download coursera classes?] #coursera #jupyter #notebook
  1. File > Open ...
  2. Launch new terminal instance: New > Terminal
  3. tarball the folder:
tar czvhf coursera.tar.gz *
  1. a. split it (usually this file might be too large for your instance to allow download)
split -b 90M -d coursera.tar.gz coursera.
@AjinkyaChavan9
AjinkyaChavan9 / Procfile
Created September 21, 2020 13:35
Procfile required by Heroku
web: sh setup.sh && streamlit run RGB_web_app.py
@AjinkyaChavan9
AjinkyaChavan9 / setup.sh
Created September 21, 2020 13:27
Setup file for Heroku
mkdir -p ~/.streamlit
echo "[server]
headless = true
port = $PORT
enableCORS = false
" > ~/.streamlit/config.toml
@AjinkyaChavan9
AjinkyaChavan9 / RGB_web_app.py
Last active September 19, 2020 20:20
RGB Color Classifier Web App using Streamlit
# -*- coding: utf-8 -*-
import streamlit as st
import PIL
from PIL import Image, ImageOps
from color_classifier import predict_color #importing predicting color function
# display image with the size and rgb color
def display_image():
img = Image.new("RGB", (200, 200), color=(Red,Green,Blue))
img = ImageOps.expand(img, border=1, fill='black') # border to the img
@AjinkyaChavan9
AjinkyaChavan9 / color_classifier.py
Last active September 19, 2020 19:50
Function to Predict Colors from RGB input
# -*- coding: utf-8 -*-
## Importing Libraries
import numpy as np
# Importing Tensorflow
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
@AjinkyaChavan9
AjinkyaChavan9 / 1_import_library.py
Last active September 19, 2020 18:44
Save RGB Color Classifier Model
!pip install pyyaml h5py # Required to save models in HDF5 format
@AjinkyaChavan9
AjinkyaChavan9 / requirements.txt
Last active September 21, 2020 15:07
RGB Color Classifier Web App requirements
absl-py==0.10.0
altair==4.1.0
argon2-cffi==20.1.0
astor==0.8.1
astunparse==1.6.3
attrs==20.1.0
backcall==0.2.0
base58==2.0.1
bleach==3.1.5
blinker==1.4
@AjinkyaChavan9
AjinkyaChavan9 / Classification Report.py
Created September 7, 2020 12:46
Classification Report
#Classification Report
target_names = ['Red', 'Green', 'Blue', 'Yellow', 'Orange', 'Pink', 'Purple', 'Brown', 'Grey', 'Black', 'White']
print(classification_report(actual_encoded_test_labels, predicted_encoded_test_labels, target_names=target_names))
@AjinkyaChavan9
AjinkyaChavan9 / Confusion Matrix.py
Created September 7, 2020 12:33
Confusion Matrix
from sklearn.metrics import confusion_matrix, classification_report
confusion_matrix_test = confusion_matrix(actual_encoded_test_labels, predicted_encoded_test_labels)
f,ax = plt.subplots(figsize=(16,12))
categories = ['Red', 'Green', 'Blue', 'Yellow', 'Orange', 'Pink', 'Purple', 'Brown', 'Grey', 'Black', 'White']
sns.heatmap(confusion_matrix_test, annot=True, cmap='Blues', fmt='d',
xticklabels = categories,
yticklabels = categories)
plt.show()
model.evaluate(x=test_dataset, y=test_labels)