Spaces:
Sleeping
Sleeping
File size: 671 Bytes
a08c80c 8343da6 a08c80c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | from textblob import TextBlob
from newspaper import Article
import nltk
nltk.download("punkt_tab")
from flask import Flask,render_template,request
app=Flask(__name__)
@app.route("/",methods=['GET'])
def search():
return render_template("index.html")
@app.route("/show",methods=["POST"])
def show():
url=request.form['link']
article=Article(url)
article.download()
article.parse()
article.nlp()
analysis=TextBlob(article.text)
data=[article.title,article.publish_date,article.authors,article.summary,article.keywords,analysis.polarity]
return render_template("index.html",data=data)
if __name__=="__main__":
app.run(debug=True)
|