Skip to content

Commit 568471e

Browse files
First commit
0 parents  commit 568471e

File tree

1,583 files changed

+293418
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,583 files changed

+293418
-0
lines changed

__pycache__/app.cpython-312.pyc

531 Bytes
Binary file not shown.

app.py

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
from flask import Flask, render_template, request
2+
import requests
3+
4+
app = Flask(__name__)
5+
6+
@app.route("/", methods=["GET", "POST"])
7+
def Index():
8+
return render_template("index.html")
9+
10+
@app.route("/Summarize", methods=["GET", "POST"])
11+
def Summarize():
12+
if request.method == "POST":
13+
API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn"
14+
headers = {"Authorization": "Bearer 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"}
15+
16+
data = request.form.get("data", "")
17+
minL = maxL//4
18+
maxL = int(request.form["maxL"])
19+
20+
def query(payload):
21+
response = requests.post(API_URL, headers=headers, json=payload)
22+
return response.json()
23+
24+
output = query({
25+
"inputs": data,
26+
"parameters": {"min_length": minL, "max_length": maxL},
27+
})[0]
28+
return render_template("index.html", result=output["summary_text"])
29+
else:
30+
return render_template("index.html")
31+
32+
if __name__ == '__main__':
33+
app.run(debug=True)
34+
35+
36+
37+
38+
'''from flask import Flask, render_template, url_for, request
39+
import requests
40+
41+
42+
app = Flask(__name__)
43+
@app.route("/", methods = ["GET","POST"])
44+
def Index():
45+
return render_template("index.html")
46+
47+
@app.route("/Summarize", methods =["GET", "POST"])
48+
def Summarize():
49+
if request.methods == "POST":
50+
API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn"
51+
headers = {"Authorization": "Bearer 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"}
52+
53+
data = request.form["data"]
54+
minL = 20
55+
maxL = 70
56+
57+
def query(payload):
58+
response = requests.post(API_URL, headers=headers, json=payload)
59+
return response.json()
60+
61+
output = query({
62+
"inputs": data,
63+
"parameters":{"min_length": minL,"max_length": maxL},
64+
})
65+
return render_template("index.html",result = output)
66+
else:
67+
return render_template("index.html")
68+
69+
if __name__ == '__main__':
70+
app.debug=True
71+
app.run()'''

dummy.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import requests
2+
3+
API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn"
4+
headers = {"Authorization": "Bearer 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"}
5+
6+
data = '''The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world,
7+
a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres.
8+
Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.
9+
'''
10+
minL = int(input())
11+
maxL = int(input())
12+
def query(payload):
13+
response = requests.post(API_URL, headers=headers, json=payload)
14+
return response.json()
15+
16+
output = query({
17+
"inputs": data,
18+
"parameters":{"min_length": minL,"max_length": maxL},
19+
})
20+
21+
print(output)

static/SynopserLogo.jpg

72.6 KB
Loading

templates/index.html

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Data Summarization</title>
9+
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
10+
<link href="/static/css/jquery-ui.min.css" rel="stylesheet">
11+
</head>
12+
13+
<body>
14+
15+
<header style="background-color: #004A56;"
16+
class="fixed inset-0 w-full flex flex-col justify-center justify-items-center content-center h-20 rounded-b-lg">
17+
<img src="/static/images/SynopserLogo.png" alt="Logo"
18+
class="object-contain w-16 self-center md:self-left md:w-30">
19+
<div class="self-center text-white">Data Summarization</div>
20+
</header>
21+
22+
<section class="flex flex-wrap mt-20 w-full">
23+
<div class="w-full md:w-1/2">
24+
<form class="w-full flex flex-col md:h-screen" action="{{url_for('Summarize')}}" method="post">
25+
<textarea class="w-11/12 md:h-3/4 m-2 p-2 border-black rounded-lg border self-center justify-center"
26+
name="data" id="data" cols="30" rows="10" placeholder="Enter your Data"
27+
required="required"></textarea>
28+
<div class="flex self-center">
29+
<h3>Summary Length</h3>
30+
<input type="range" class="m-2" min="20" max="1000" name="maxL">
31+
</div>
32+
<div class="flex self-center">
33+
<button class="m-1 bg-green-500 hover:bg-blue-700 text-white font-semi-bold py-2 px-4 rounded-lg"
34+
type="submit" onclick="Check()">Submit</button>
35+
<button class="m-1 bg-red-500 hover:bg-blue-700 text-white font-semi-bold py-2 px-4 rounded-lg"
36+
type="reset">Clear</button>
37+
</div>
38+
</form>
39+
</div>
40+
<div class="w-full md:w-1/2">
41+
<div class="mt-2 flex flex-col w-full md:h-screen">
42+
<textarea style="background-color: #EDFFD2;"
43+
class="w-11/12 border-green-600 rounded-lg p-2 border self-center justify-center md:h-3/4" rows="10"
44+
cols="30" name="result" readonly placeholder="Your Summary">{{result}}</textarea>
45+
<button
46+
class="m-2 bg-blue-400 hover:bg-blue-700 text-white font-semi-bold py-2 px-4 rounded-lg self-center"
47+
onclick="myFunction()">Copy text</button>
48+
</div>
49+
</div>
50+
</section>
51+
<script>
52+
function myFunction() {
53+
54+
var copyText = document.getElementById("myInput");
55+
56+
57+
copyText.select();
58+
copyText.setSelectionRange(0, 99999); /* For mobile devices */
59+
60+
61+
navigator.clipboard.writeText(copyText.value);
62+
}
63+
</script>
64+
<script>
65+
function Check() {
66+
67+
var reg = /<(.|\n)*>/g;
68+
69+
if (reg.test(document.getElementById("data").value) == true) {
70+
var ErrorText = 'Make Sure You Provide Valid Data.';
71+
alert('Error Text');
72+
73+
}
74+
}
75+
</script>
76+
</body>
77+
78+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Copyright 2010 Pallets
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
1. Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
14+
3. Neither the name of the copyright holder nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Metadata-Version: 2.1
2+
Name: MarkupSafe
3+
Version: 2.1.5
4+
Summary: Safely add untrusted strings to HTML/XML markup.
5+
Home-page: https://palletsprojects.com/p/markupsafe/
6+
Maintainer: Pallets
7+
Maintainer-email: [email protected]
8+
License: BSD-3-Clause
9+
Project-URL: Donate, https://palletsprojects.com/donate
10+
Project-URL: Documentation, https://markupsafe.palletsprojects.com/
11+
Project-URL: Changes, https://markupsafe.palletsprojects.com/changes/
12+
Project-URL: Source Code, https://github.com/pallets/markupsafe/
13+
Project-URL: Issue Tracker, https://github.com/pallets/markupsafe/issues/
14+
Project-URL: Chat, https://discord.gg/pallets
15+
Classifier: Development Status :: 5 - Production/Stable
16+
Classifier: Environment :: Web Environment
17+
Classifier: Intended Audience :: Developers
18+
Classifier: License :: OSI Approved :: BSD License
19+
Classifier: Operating System :: OS Independent
20+
Classifier: Programming Language :: Python
21+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
22+
Classifier: Topic :: Text Processing :: Markup :: HTML
23+
Requires-Python: >=3.7
24+
Description-Content-Type: text/x-rst
25+
License-File: LICENSE.rst
26+
27+
MarkupSafe
28+
==========
29+
30+
MarkupSafe implements a text object that escapes characters so it is
31+
safe to use in HTML and XML. Characters that have special meanings are
32+
replaced so that they display as the actual characters. This mitigates
33+
injection attacks, meaning untrusted user input can safely be displayed
34+
on a page.
35+
36+
37+
Installing
38+
----------
39+
40+
Install and update using `pip`_:
41+
42+
.. code-block:: text
43+
44+
pip install -U MarkupSafe
45+
46+
.. _pip: https://pip.pypa.io/en/stable/getting-started/
47+
48+
49+
Examples
50+
--------
51+
52+
.. code-block:: pycon
53+
54+
>>> from markupsafe import Markup, escape
55+
56+
>>> # escape replaces special characters and wraps in Markup
57+
>>> escape("<script>alert(document.cookie);</script>")
58+
Markup('&lt;script&gt;alert(document.cookie);&lt;/script&gt;')
59+
60+
>>> # wrap in Markup to mark text "safe" and prevent escaping
61+
>>> Markup("<strong>Hello</strong>")
62+
Markup('<strong>hello</strong>')
63+
64+
>>> escape(Markup("<strong>Hello</strong>"))
65+
Markup('<strong>hello</strong>')
66+
67+
>>> # Markup is a str subclass
68+
>>> # methods and operators escape their arguments
69+
>>> template = Markup("Hello <em>{name}</em>")
70+
>>> template.format(name='"World"')
71+
Markup('Hello <em>&#34;World&#34;</em>')
72+
73+
74+
Donate
75+
------
76+
77+
The Pallets organization develops and supports MarkupSafe and other
78+
popular packages. In order to grow the community of contributors and
79+
users, and allow the maintainers to devote more time to the projects,
80+
`please donate today`_.
81+
82+
.. _please donate today: https://palletsprojects.com/donate
83+
84+
85+
Links
86+
-----
87+
88+
- Documentation: https://markupsafe.palletsprojects.com/
89+
- Changes: https://markupsafe.palletsprojects.com/changes/
90+
- PyPI Releases: https://pypi.org/project/MarkupSafe/
91+
- Source Code: https://github.com/pallets/markupsafe/
92+
- Issue Tracker: https://github.com/pallets/markupsafe/issues/
93+
- Chat: https://discord.gg/pallets
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
MarkupSafe-2.1.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2+
MarkupSafe-2.1.5.dist-info/LICENSE.rst,sha256=RjHsDbX9kKVH4zaBcmTGeYIUM4FG-KyUtKV_lu6MnsQ,1503
3+
MarkupSafe-2.1.5.dist-info/METADATA,sha256=icNlaniV7YIQZ1BScCVqNaRtm7MAgfw8d3OBmoSVyAY,3096
4+
MarkupSafe-2.1.5.dist-info/RECORD,,
5+
MarkupSafe-2.1.5.dist-info/WHEEL,sha256=j9Aissza3750LQHFAQyYerNjmkEON1-8w_RaZNFtKSs,102
6+
MarkupSafe-2.1.5.dist-info/top_level.txt,sha256=qy0Plje5IJuvsCBjejJyhDCjEAdcDLK_2agVcex8Z6U,11
7+
markupsafe/__init__.py,sha256=m1ysNeqf55zbEoJtaovca40ivrkEFolPlw5bGoC5Gi4,11290
8+
markupsafe/__pycache__/__init__.cpython-312.pyc,,
9+
markupsafe/__pycache__/_native.cpython-312.pyc,,
10+
markupsafe/_native.py,sha256=_Q7UsXCOvgdonCgqG3l5asANI6eo50EKnDM-mlwEC5M,1776
11+
markupsafe/_speedups.c,sha256=n3jzzaJwXcoN8nTFyA53f3vSqsWK2vujI-v6QYifjhQ,7403
12+
markupsafe/_speedups.cp312-win_amd64.pyd,sha256=CLz8k0mpvM-dgLP0eSHpGYHm8shlGxXoCinA12zgHsY,15872
13+
markupsafe/_speedups.pyi,sha256=f5QtwIOP0eLrxh2v5p6SmaYmlcHIGIfmz0DovaqL0OU,238
14+
markupsafe/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Wheel-Version: 1.0
2+
Generator: bdist_wheel (0.42.0)
3+
Root-Is-Purelib: false
4+
Tag: cp312-cp312-win_amd64
5+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
markupsafe
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2010 Jason Kirtland
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a
4+
copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included
12+
in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)