Skip to content

Instantly share code, notes, and snippets.

Harsh Singhal harshsinghal

View GitHub Profile
@harshsinghal
harshsinghal / resnet50_service.py
Last active Jul 7, 2019
ResNet50 image labeling service using CherryPy web framework
View resnet50_service.py
from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from keras.applications.resnet50 import preprocess_input, decode_predictions
import numpy as np
import os
import cherrypy
import tensorflow as tf
import uuid
import simplejson
@harshsinghal
harshsinghal / get_iris_insert_pg.py
Last active Jul 2, 2019
Grab data using pandas and insert into PostgreSQL db
View get_iris_insert_pg.py
# Used in blog post https://harshsinghal.dev/post/learn-sql-in-a-browser-with-postgresql-and-pgweb.html
import pandas as pd
from sqlalchemy import create_engine
iris = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')
engine = create_engine('postgresql://postgres:postgres@localhost:5432/postgres')
iris.to_sql("iris", engine, if_exists = 'replace', index=False, chunksize=1000)
You can’t perform that action at this time.