Skip to content

Instantly share code, notes, and snippets.

View sciencelee's full-sized avatar

Aaron Lee sciencelee

View GitHub Profile
import pandas as pd
# these are the top 5 rated high schools in Chicago
top5 = ['Walter Payton College Prep',
'northside college preparatory high school',
'Jones College Prep',
'Whitney Young High',
'Lane Tech High School',
]
from geopy.geocoders import Nominatim
# create a Nominatim object
geolocator = Nominatim(user_agent="your_app_name")
location = geolocator.geocode("121 N LaSalle St, Chicago")
from flask import Flask, render_template, request
import numpy as np
from sklearn.linear_model import LinearRegression
import pickle
with open('model/my_model.pkl', 'rb') as file:
model = pickle.load(file)
app = Flask(__name__)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Model</title>
</head>
<body>
<form method=post enctype=multipart/form-data>
Beds: <input type="number" name="beds" min="1" max="10"><br>
Baths: <input type=number name="baths" min="1" max="10"><br>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Model</title>
</head>
<body>
My prediction: {{ pred }}
</body>
</html>
@app.route('/')
def index():
pred = model.predict(np.array([1,2,3]))
return render_template('index.html', pred=str(pred))
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Model</title>
</head>
<body>
My prediction:
</body>
</html>
from flask import Flask, render_template
import numpy as np
from sklearn.linear_model import LinearRegression
import pickle
with open('model/my_model.pkl', 'rb') as file:
model = pickle.load(file)
app = Flask(__name__)
from flask import Flask
import numpy as np
from sklearn.linear_model import LinearRegression
import pickle
with open('model/my_model.pkl', 'rb') as file:
model = pickle.load(file)
app = Flask(__name__)
@sciencelee
sciencelee / basic_flask.py
Created December 7, 2020 03:56
Minimal Flask app.
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'