diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5757ef4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +test_env/* diff --git a/app.py b/app.py index 7de6c21..e6af92f 100644 --- a/app.py +++ b/app.py @@ -12,14 +12,19 @@ #create our "home" route using the "housingprice.html" page @app.route('/') def home(): - return render_template('input.html') + + context={ + 'sentences': 5, + 'summary':2, + } + return render_template('base.html',context=context) #Set a post method to yield predictions on page @app.route('/predict', methods = ['POST']) def predict(): - document =request.form["z1"] #fetching text from html form - + document =request.form["content"] #fetching text from html form + num = request.form["sentences"] #fetching text from html form #Load English into Spacy nlp = spacy.load("en_core_web_sm") document = nlp(document) @@ -54,16 +59,16 @@ def predict(): sent_strength[sent]=freq_word[word.text] #Summarizing sentences - summarized_sentences = nlargest(4, sent_strength, key=sent_strength.get) + summarized_sentences = nlargest(int(num) if num else 4, sent_strength, key=sent_strength.get) #final sentence final_sentences= [w.text for w in summarized_sentences] summary= ''.join(final_sentences) # return summary - return render_template('output.html', summary=summary) + return summary # print(summarise(text)) #Run app if __name__ == "__main__": - app.run(debug=True) \ No newline at end of file + app.run(debug=False) \ No newline at end of file diff --git a/static/main.css b/static/main.css new file mode 100644 index 0000000..d8c0225 --- /dev/null +++ b/static/main.css @@ -0,0 +1,145 @@ +html { + scroll-behavior: smooth; +} + +.bd-placeholder-img { + font-size: 1.125rem; + text-anchor: middle; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +@media (min-width: 768px) { + .bd-placeholder-img-lg { + font-size: 3.5rem; + } +} + +body { + font-size: .875rem; +} + +.feather { + width: 16px; + height: 16px; + vertical-align: text-bottom; +} + +/* Sidebar*/ + +.sidebar { + position: fixed; + top: 0; + bottom: 0; + left: 0; + z-index: 100; + /* Behind the navbar */ + padding: 48px 0 0; + /* Height of navbar */ + box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1); +} + +@media (max-width: 767.98px) { + .sidebar { + top: 5rem; + } +} + +.sidebar-sticky { + position: relative; + top: 0; + height: calc(100vh - 48px); + padding-top: .5rem; + overflow-x: hidden; + overflow-y: auto; + /* Scrollable contents if viewport is shorter than content. */ +} + +.sidebar .nav-link { + font-weight: 500; + color: #333; +} + +.sidebar .nav-link .feather { + margin-right: 4px; + color: #727272; +} + +.sidebar .nav-link.active { + color: #007bff; +} + +.sidebar .nav-link:hover .feather, +.sidebar .nav-link.active .feather { + color: inherit; +} + +.sidebar-heading { + font-size: .75rem; + text-transform: uppercase; +} + +/*Navbar*/ +.navbar-brand { + padding-top: .75rem; + padding-bottom: .75rem; + font-size: 1rem; + background-color: rgba(0, 0, 0, .25); + box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25); +} + +.navbar .navbar-toggler { + top: .25rem; + right: 1rem; +} + +.navbar .form-control { + padding: .75rem 1rem; + border-width: 0; + border-radius: 0; +} + +.form-control-dark { + color: #fff; + background-color: rgba(255, 255, 255, .1); + border-color: rgba(255, 255, 255, .1); +} + +.form-control-dark:focus { + border-color: transparent; + box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); +} + +.loader { + width: 100px; + height: 100px; + border-radius: 50%; + border: 3px solid blue; + border-left: 3px solid white; + animation: loader 0.7s ease-in 0.1s infinite; +} + +/* animations */ +@keyframes loader { + 0% { + transform: rotate(0deg); + } + + 25% { + transform: rotate(90deg); + } + + 50% { + transform: rotate(180deg); + } + + 75% { + transform: rotate(270deg); + } + + 100% { + transform: rotate(360deg); + } +} \ No newline at end of file diff --git a/template/base.html b/template/base.html new file mode 100644 index 0000000..1716519 --- /dev/null +++ b/template/base.html @@ -0,0 +1,197 @@ + + + +
+ + + + +