Skip to main content

Flask web applications


We can build complex web applications using Python. For that, we would need one of the third party Python web framework Flask.

e:\python>pip install flask

# flask
#web2.py
from flask import Flask
app=Flask(__name__)

@app.route("/")
def hello():
    return "Hello Chennai"


e:\python>set FLASK_APP=web2.py

to run the app server
e:\python>flask run

open browser and goto
http://127.0.0.1:5000/


Another example

#web4.py

from flask import Flask , render_template
app= Flask(__name__)

@app.route("/")
@app.route("/home")
def home():
    return render_template('home.html')

@app.route("/about")
def about():
    return render_template('about.html')

@app.route("/home2")
def home2():
    return render_template('home2.html')

@app.route("/isdeep")
def isdeep():
    return render_template('isdeep.html')

if __name__ == '__main__':
    app.debug=True
    app.run




Popular posts from this blog

A quick introduction to AI and ML

Hari Nair Artificial intelligence (AI) is a branch of computer science. Its main goal is to create smart machines that can learn on their own and are capable of thinking like humans. The term 'artificial intelligence' commonly applies to devices or applications capable of carrying out specific tasks in human ways, by mimicking cognitive functions such as: • learning • reasoning • problem-solving • visual perception • language-understanding There are two main types of AI: Applied AI - is more common and includes systems designed to intelligently carry out a single task, example: move a driverless vehicle. This category is also known as 'weak' or 'narrow' AI. Generalized AI - is less common and includes systems or devices that can theoretically handle any task, as they carry enough intelligence to find solutions to unfamiliar problems. Generalized AI is also known as 'strong' AI. Examples of true strong AI don't curren...

AI in Banking and Financial institutions

Hari Nair WeChat is a Chinese social media and mobile payment app, released during the year 2011 - China’s billion-user messaging app ClearBank , an innovative clearing bank in the UK based entirely on the cloud and offering an open-standards connection API, are showing the way to a future of distributed, hyper-efficient core banking services - Banking as a service!. AI will make intelligent automation   to do away with competition from FinTech players.  AI will enable banks to leverage  Machine Learning  optimally to drive operational and cost efficiencies.  By adapting AI, Banking sector have already taken actions, unlocking significant opportunities . Cognitive technology with Artificial Intelligence (AI) brings the advantage of Digitization to Banks.   SBI launched SIA, an AI-powered chat assistant that addresses customer enquiries  with everyday banking tasks.  Eva (Electronic Virtual Assistant) has addressed over 2...

AI and the Insurance Industry

  Hari Nair Needing insurance is like needing a parachute. If it isn't there the first time, chances are you won't be needing it again. --Author unknown Building customer relationships and managing risks are key for Insurance companies. Insurance companies are making extensive use of AI  are reaping the benefits of increased customer satisfaction adding to their bottom line.  AI has the potential to transform the insurance experience for customers from frustrating and bureaucratic to something fast, on-demand, and more affordable. Tailor-made insurance products will attract more customers at fairer prices. If insurers apply AI tech to the mountain of data at their disposal, we will soon start to see more flexible insurance such as on-demand pay-as-you-go insurance, and premiums that automatically adjust in response to accidents, customer health, etc.   Insurers have yet to unlock the full potential of AI. Machine learning use cases in Insu...