Posts

Showing posts with the label Flask App Work

Python Tutorial

  Python  Tutorial print ( "Hello, World!" ) What is Python? Python is a popular programming language. It was created by Guido van Rossum, and released in 1991. It is used for: web development (server-side), software development, mathematics, system scripting. What can Python do? Python can be used on a server to create web applications. Python can be used alongside software to create workflows. Python can connect to database systems. It can also read and modify files. Python can be used to handle big data and perform complex mathematics. Python can be used for rapid prototyping, or for production-ready software development. Why Python? Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc). Python has a simple syntax similar to the English language. Python has syntax that allows developers to write programs with fewer lines than some other programming languages. Python runs on an interpreter system, meaning that code can be executed as soon as it is wri

Python – Face detection and sending notification

Image
  Python – Face detection and sending notification A simple method is implemented using python how to detect human face and after detecting sends notifications to the user. If face is not recognised it does not send notifications to the owner. WE WILL USE: OpenCV:  OpenCV is a huge open-source library for computer vision, machine learning, and image processing. OpenCV supports a wide variety of programming languages like Python, C++, Java, etc. It can process images and videos to identify objects, faces, or even the handwriting of a human. When it is integrated with various libraries, such as Numpy which is a highly optimized library for numerical operations, then the number of weapons increases in your Arsenal i.e whatever operations one can do in Numpy can be combined with OpenCV.This OpenCV tutorial will help you learn the Image-processing from Basics to Advance, like operations on Images, Videos using a huge set of Opencv-programs and projects. Sinch  :  Sinch  is used to send mess

Face Detection using Python and OpenCV with webcam

Image
  Face Detection using Python and OpenCV with webcam How to use : Create a directory in your pc and name it (say project) Create two python files named create_data.py and face_recognize.py, copy the first source code and second source code in it respectively. Copy haarcascade_frontalface_default.xml to the project directory, you can get it in opencv or from here . You are ready to now run the following codes. create_data.py # Creating database # It captures images and stores them in datasets # folder under the folder name of sub_data import cv2, sys, numpy, os haar_file = 'haarcascade_frontalface_default.xml' # All the faces data will be # present this folder datasets = 'G:\PARAS\datasets' //make datasets as new folder like i did in this path then sub # These are sub data sets of folder, # for my faces I've used my name you can # change the label here akhi is a sub folder insde datasets where web image will store by webcamera sub_data = 'akhi' path = os.pat

How to Detect Shapes in Images in Python using OpenCV

Image
  How to Detect Shapes in Images in Python using OpenCV import numpy as np import matplotlib.pyplot as plt import cv2 import sys # read the image from arguments image = cv2.imread( r'G:\PARAS\anuradha.png' ) # convert to grayscale grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # perform edge detection edges = cv2.Canny(grayscale, 30 , 100 ) # detect lines in the image using hough lines technique lines = cv2.HoughLinesP(edges, 1 , np.pi/ 180 , 60 , np.array([]), 50 , 5 ) # iterate over the output lines and draw them for line in lines: for x1, y1, x2, y2 in line: cv2.line(image, (x1, y1), (x2, y2), color =( 20 , 220 , 20 ), thickness = 3 ) # show the image plt.imshow(image) plt.show()

Text Detection and Extraction using OpenCV and OCR

  Text Detection and Extraction using OpenCV and OCR Applying OCR: Loop through each contour and take the x and y coordinates and the width and height using the function  cv2.boundingRect() . Then draw a rectangle in the image using the function cv2.rectangle() with the help of obtained x and y coordinates and the width and height. There are 5 parameters in the cv2.rectangle(), the first parameter specifies the input image, followed by the x and y coordinates (starting coordinates of the rectangle), the ending coordinates of the rectangle which is (x+w, y+h), the boundary color for the rectangle in RGB value and the size of the boundary. Now crop the rectangular region and then pass it to the tesseract to extract the text from the image. Then we open the created text file in append mode to append the obtained text and close the file Finding Contours: cv2.findContours()  is used to find contours in the dilated image. There are three arguments in cv.findContours(): the source image, the

Redirecting to another page with button click in Python-flask

Image
  Redirecting to another page with  click in Python-flask Suppose we have to attach any html page Link in any webpage in python  < a class ="dropdown-item" href = "{{ url_for('terms') }}" >< span class ="item-text" > Terms Conditions </ span ></ a > < div class ="dropdown-items-divide-hr" ></ div > < a class ="dropdown-item" href = "{{ url_for('privacy') }}" >< span class ="item-text" > Privacy Policy </ span ></ a > THEN GO TO UR MAIN.PY PAGE : @app.route ( '/terms' )===> it is the name of file which we have mentioned inside href of above def terms():====> keep it same as name above return render_template( 'terms-conditions.html' )====then this page will open when click avove link::: Terms Conditions - Evolo - StartUp HTML Landing Page Template @app.route ( '/privacy' ) ===> it is the nam

web application using Flask and deploy it to the cloud

Image
  web application using Flask and deploy it to the cloud How Does a Flask App Work? The code lets us run a basic web application that we can serve, as if it were a website. from flask import Flask app = Flask ( __name__ ) @app . route ( "/" ) def home ( ) : return "Hello, World!" if __name__ == "__main__" : app . run ( debug = True ) This piece of code is stored in our main.py. Line 1:  Here we are importing the Flask module and creating a Flask web server from the Flask module. Line 3: __name__ means this current file . In this case, it will be main.py. This current file will represent my web application. We are creating an instance of the Flask class and calling it app. Here we are creating a new web application. Line 5:  It represents the default page. For example, if I go to a website such as “google.com/” with nothing after the slash. Then this will be the default page of Google. This is what the @app.route(“/”) will represe