Spaces:
Runtime error
Runtime error
ricardo-lsantos
commited on
Commit
•
486ac61
1
Parent(s):
2221ec2
Added Footer. Changed the output to clear text instead of object printing
Browse files- .gitignore +1 -0
- app.py +22 -5
- requirements.txt +1 -0
- utils/__init__.py +0 -0
- utils/footer.py +30 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.venv
|
app.py
CHANGED
@@ -1,9 +1,26 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
6 |
output = summarizer(text)
|
7 |
st.write("# Summary")
|
8 |
-
st.write(output)
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
+
|
4 |
+
def getPipeline():
|
5 |
+
return pipeline("summarization")
|
6 |
+
|
7 |
+
def btnSummarizeAction(text):
|
8 |
+
summarizer = getPipeline()
|
9 |
output = summarizer(text)
|
10 |
st.write("# Summary")
|
11 |
+
st.write(output[0]['summary_text'])
|
12 |
+
|
13 |
+
|
14 |
+
def app():
|
15 |
+
st.title("Summarization App")
|
16 |
+
st.write("This is my first app using the Hugging Face transformers library.")
|
17 |
+
text = st.text_area('Text to summarize', 'Enter text here...')
|
18 |
+
|
19 |
+
if st.button('Summarize'):
|
20 |
+
if text is not None:
|
21 |
+
btnSummarizeAction(text)
|
22 |
+
else:
|
23 |
+
st.write("Please enter some text to summarize")
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
app()
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
|
|
1 |
torch
|
2 |
transformers
|
|
|
1 |
+
streamlit
|
2 |
torch
|
3 |
transformers
|
utils/__init__.py
ADDED
File without changes
|
utils/footer.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
footer="""<style>
|
4 |
+
a:link , a:visited{
|
5 |
+
color: blue;
|
6 |
+
background-color: transparent;
|
7 |
+
text-decoration: underline;
|
8 |
+
}
|
9 |
+
|
10 |
+
a:hover, a:active {
|
11 |
+
color: red;
|
12 |
+
background-color: transparent;
|
13 |
+
text-decoration: underline;
|
14 |
+
}
|
15 |
+
|
16 |
+
.footer {
|
17 |
+
position: fixed;
|
18 |
+
left: 0;
|
19 |
+
bottom: 0;
|
20 |
+
width: 100%;
|
21 |
+
background-color: white;
|
22 |
+
color: black;
|
23 |
+
text-align: center;
|
24 |
+
}
|
25 |
+
</style>
|
26 |
+
<div class="footer">
|
27 |
+
<p>Developed with ❤ by <a style='display: block; text-align: center;' href="https://huggingface.co/ricardo-lsantos" target="_blank">Ricardo Lisboa Santos</a></p>
|
28 |
+
</div>
|
29 |
+
"""
|
30 |
+
st.markdown(footer,unsafe_allow_html=True)
|