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
# 1. Library imports | |
import uvicorn | |
from fastapi import FastAPI | |
# 2. Create the app object | |
app = FastAPI() | |
# 3. Index route, opens automatically on http://127.0.0.1:8000 | |
@app.get('/') | |
def index(): |
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
import uvicorn | |
from fastapi import FastAPI | |
app = FastAPI() | |
@app.get('/') | |
def index(): | |
''' | |
This is a first docstring. | |
''' |
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
# 1. Library imports | |
import uvicorn | |
from fastapi import FastAPI | |
from Model import IrisModel, IrisSpecies | |
# 2. Create app and model objects | |
app = FastAPI() | |
model = IrisModel() | |
# 3. Expose the prediction functionality, make a prediction from the passed |
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
import requests | |
new_measurement = { | |
'sepal_length': 5.7, | |
'sepal_width': 3.1, | |
'petal_length': 4.9, | |
'petal_width': 2.2 | |
} | |
response = requests.post('http://127.0.0.1:8000/predict', json=new_measurement) |
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
library(gapminder) | |
library(ggplot2) | |
library(dplyr) | |
library(shiny) | |
ui <- fluidPage( | |
titlePanel("Gapminder explorer", windowTitle = NULL), | |
plotOutput("line") | |
) |
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
library(shiny) | |
library(gapminder) | |
library(dplyr) | |
library(ggplot2) | |
ui <- fluidPage( | |
titlePanel("Gapminder explorer", windowTitle = NULL), | |
sidebarPanel( | |
width = 3, | |
tags$h4("Filter"), |
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
msg = EmailMessage() | |
msg['Subject'] = 'This is my first Python email' | |
msg['From'] = EMAIL_ADDRESS | |
msg['To'] = EMAIL_ADDRESS | |
msg.set_content('And it actually works') | |
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp: | |
smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD) | |
smtp.send_message(msg) |
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
msg = EmailMessage() | |
msg['Subject'] = 'This is my email for multiple people' | |
msg['From'] = EMAIL_ADDRESS | |
msg['To'] = ['recipient1@gmail.com', 'recipient2@gmail.com'] | |
msg.set_content('It works!') | |
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp: | |
smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD) | |
smtp.send_message(msg) |
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
msg = EmailMessage() | |
msg['Subject'] = 'This is my email with PDF attachment' | |
msg['From'] = EMAIL_ADDRESS | |
msg['To'] = EMAIL_ADDRESS | |
msg.set_content('See below') | |
with open('ExampleDoc.pdf', 'rb') as pdf: | |
msg.add_attachment(pdf.read(), maintype='application', subtype='octet-stream', filename=pdf.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
import numpy as np | |
import pandas as pd | |
iris = pd.read_csv('iris.csv') | |
# Keep an untouched copy for later | |
iris_orig = iris.copy() | |
iris.head() |
OlderNewer