Skip to content

Instantly share code, notes, and snippets.

View Kakarot-2000's full-sized avatar
💭
studying graphql

Rohan Krishna Ullas Kakarot-2000

💭
studying graphql
  • India
View GitHub Profile
x_train=x_train.astype('float32')
x_test=x_test.astype('float32')
#intializing callbacks
early_stopping=keras.callbacks.EarlyStopping(patience=15,restore_best_weights=True)
model1.compile(optimizer='Adam',loss='categorical_crossentropy',metrics=['accuracy'])
model1.fit(x_train,y_train,
batch_size=64,
fer_json = model1.to_json()
with open("fer.json", "w") as json_file:
json_file.write(fer_json)
model1.save_weights("fer.h5")
flask
tensorflow
opencv-python
numpy
from flask import Flask, render_template, Response
import cv2
import numpy as np
from tensorflow.keras.models import model_from_json
from tensorflow.keras.preprocessing import image
model = model_from_json(open("fer.json", "r").read()) #load model
model.load_weights('fer.h5') #load weights
face_haar_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
camera = cv2.VideoCapture(0)
app = Flask(__name__)
@Kakarot-2000
Kakarot-2000 / run.py
Last active May 4, 2021 09:26
importing the libraries
import smtplib, ssl
import bs4,webbrowser
import requests
def getLink(number):
link='https://www.google.com/search?q='+'geeksforgeeks puzzle '+number
response=requests.get(link)
ls=[]
links=[]
try:
soup=bs4.BeautifulSoup(response.text,features="html.parser")
for tag in soup.find_all('a'):
def sendMail():
smtp_server = "smtp.gmail.com"
port = 587 # For starttls
sender_email = "sender-mail-id" #sender's mail id
receiver_email = ['reciever-mail-id'] #list of reciever's mail ids
#password = getpass.getpass(prompt="Type your password and press enter: ")
password = "enter-your-password-here"
print('Runnning\n')
file1 = open("data.txt","r")
from apscheduler.schedulers.blocking import BlockingScheduler
from run import sendMail
sched = BlockingScheduler()
@sched.scheduled_job('cron', day_of_week='mon-fri', hour=8)
def scheduled_job():
print('This job is run every weekday at 8 AM.')
sendMail()
sched.start()
clock: python clock.py