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

Machine Learning in Healthcare

Hari Nair Hospitals are constantly trying to improve the quality of care they deliver.  Machine learning (ML)  is creating disruptive changes in the healthcare industry.  ML was first applied to tailoring antibiotic dosages for patients in the 1970s..  Python developers can build solutions that benefit human health and well-being. Python and its frameworks work on principles  agreed upon the HIPAA checklist. Some of the practical areas for ML are: Medical image processing and anomaly detection Managing Hospitals and Patient Care Diagnostics Disease Prognosis Prediction Natural Language Processing (NLP) for Administrative Tasks Patient Risk Identification Computer vision methods have long been employed to automatically analyze biomedical images. The recent advent of deep learning has replaced many other machine learning methods, since it avoids the creation of hand-engineering features;  removing a critical source of error from the pro...

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...