-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPPLICATION.py
More file actions
42 lines (27 loc) · 1.1 KB
/
Copy pathAPPLICATION.py
File metadata and controls
42 lines (27 loc) · 1.1 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from flask import Flask, render_template, request
from urllib.parse import urlparse
from c_t1 import text
from FunctionS import summarizer, abs_summary
app=Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/result',methods=['GET','POST'])
def result():
if request.method=="POST":
input_text=request.form['TEXT']
# Check if input is a URL
try:
url = urlparse(input_text)
if all([url.scheme, url.netloc]):
# Input is a URL, get the text from the URL
new_text = text(input_text)
except:
pass
# Process the input text
summary, original_text, text_len, summary_len = summarizer(new_text)
abst_summary = abs_summary(new_text)
# Render the result page
return render_template('result.html', summary=summary, original_text=original_text, text_len=text_len, summary_len=summary_len, abst_summary=abst_summary)
if __name__=='__main__':
app.run(debug= True)