Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from model import Abstractive_Summarization_Model
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# initialize model object
|
| 6 |
+
# @st.cache
|
| 7 |
+
def load_model():
|
| 8 |
+
return Abstractive_Summarization_Model()
|
| 9 |
+
|
| 10 |
+
# Main app engine
|
| 11 |
+
if __name__ == "__main__":
|
| 12 |
+
# display title and description
|
| 13 |
+
st.title("AI Text Summarizer")
|
| 14 |
+
st.header("Get AI generated paraphrased summaries of text!")
|
| 15 |
+
st.write("You might need to wait a couple of seconds for the model to load because i'm using a tiny cpu 🥲")
|
| 16 |
+
st.write("email me at [email protected]")
|
| 17 |
+
|
| 18 |
+
#load model
|
| 19 |
+
ASM = load_model()
|
| 20 |
+
|
| 21 |
+
# display topic input slot
|
| 22 |
+
text = st.text_input("Paste a paragraph of text in the text box below and hit ENTER!", "")
|
| 23 |
+
|
| 24 |
+
# display article paragraph
|
| 25 |
+
article_paragraph = st.empty()
|
| 26 |
+
|
| 27 |
+
if text:
|
| 28 |
+
# load wikipedia summary of topic
|
| 29 |
+
|
| 30 |
+
summary = ASM.summarize(text)
|
| 31 |
+
|
| 32 |
+
# display article summary in paragraph
|
| 33 |
+
article_paragraph.markdown(summary)
|