Skip to content

Instantly share code, notes, and snippets.

View ecdedios's full-sized avatar

Ednalyn C. De Dios ecdedios

View GitHub Profile
# sampling the data to select only 1000 tweets
df = df.sample(1000, random_state=493).reset_index(drop=True)
# load the data into a dataframe
df = pd.read_csv('trump_20200530_clean.csv')
# PyCaret's NLP module
from pycaret.nlp import *
# for working with dataframes
import pandas as pd
# to print out all the outputs
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
print("POST to url", service.scoring_uri)
print("label:", y_test[sample_index])
print("prediction:", resp.text)
resp = requests.post(service.scoring_uri, input_data, headers=headers)
sample_index = 68
input_data = '{"data": [' + str(list(X_test[sample_index])) + "]}"
headers = {"Content-Type": "application/json"}
%%time
import uuid
from azureml.core.model import InferenceConfig
from azureml.core.environment import Environment
from azureml.core.model import Model
# get the registered model
model = Model(ws, "credit_card_model")
# create an inference config i.e. the scoring script and environment
# create environment for the deploy
from azureml.core.environment import Environment
from azureml.core.conda_dependencies import CondaDependencies
from azureml.core.webservice import AciWebservice
# get a curated environment
env = Environment.get(
workspace=ws,
name="AzureML-sklearn-1.0-ubuntu20.04-py38-cpu",
version=1
# register the model
model_uri = "runs:/{}/model".format(run.info.run_id)
model = mlflow.register_model(model_uri, "credit_card_model")