Skip to content

Instantly share code, notes, and snippets.

import random
import requests
import streamlit as st
UNSPLASH_ACCESS_KEY = "<API KEY GOES HERE>"
UNSPLASH_PHOTOS_URL = "https://api.unsplash.com/search/photos?"
def main():
st.title('Social Media Magic')
with st.form(key='unsplash_images', clear_on_submit=True):
import streamlit as st
from langchain.chains import ConversationChain
from langchain.chains.conversation.memory import ConversationEntityMemory
from langchain.chains.conversation.prompt import ENTITY_MEMORY_CONVERSATION_TEMPLATE
from langchain.chat_models import ChatOpenAI
def main():
st.title("ChatGPT ChatBot🤖")
st.markdown(
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
CustomerID Genre Age Annual Income (k$) Spending Score (1-100)
0001 Male 19 15 39
0002 Male 21 15 81
0003 Female 20 16 6
0004 Female 23 16 77
0005 Female 31 17 40
0006 Female 22 17 76
0007 Female 35 18 6
0008 Female 23 18 94
0009 Male 64 19 3
from sklearn import datasets
from sklearn.neural_network import MLPClassifier
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report
iris = datasets.load_iris()
X = iris.data
#!/usr/bin/env python
# coding: utf-8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep, strftime
from random import randint
import pandas as pd
1000 399 231 305 543 351 301 126 215 242 294 275 135 128 128 122 243 251 197 180 622 355 330 280 221 140 141 134 177 162 224 199 167 144 212 192 185 159 213 191 182 153 209 183 189 164 201 177 191 165 190 165 191 165 186 164 201 175 188 163 196 166 182 150 187 164 197 166 174 144 186 164 196 166 182 150 187 164 197 166 174 145 188 164 193 167 186 163 197 167 179 147 184 157 191 165 189 164 192 167
1000 399 306 231 179 137 144 137 130 128 129 129 127 125 125 125 124 124 126 127 128 128 128 128 128 128 128 128 128 129 128 129 128 128 128 128 127 127 127 126 126 126 126 126 126 126 126 126 126 126 126 126 127 127 127 126 127 126 127 126 127 126 127 126 127 126 127 126 127 126 127 126 127 126 127 127 126 127 126 127 126 127 126 127 126 127 126 127 126 127 126 127 126 127 126 127 126 127 126 127
def calculatePredicatedValue(X, W):
f_x = np.dot(X, W)
for i in range(len(f_x)):
if f_x[i][0] > 0:
f_x[i][0] = 1
else:
f_x[i][0] = 0
return f_x
def calculateError(Y, f_x):
errorCount = 0
for i in range(len(f_x)):
if Y[i][0] != f_x[i][0]:
errorCount += 1
return errorCount
def calculateGradient(W, X, Y, f_x, learningRate):
gradient = (Y - f_x) * X
gradient = np.sum(gradient, axis=0)
# gradient = np.array([float("{0:.4f}".format(val)) for val in gradient])
temp = np.array(learningRate * gradient).reshape(W.shape)
W = W + temp
return gradient, W.astype(float)