nurindahpratiwi commited on
Commit ·
22b1490
1
Parent(s): 612ea3b
fix line
Browse files
app.py
CHANGED
|
@@ -25,6 +25,7 @@ def preprocess_pdf(file):
|
|
| 25 |
final_text = final_text + text.page_content
|
| 26 |
return final_text
|
| 27 |
|
|
|
|
| 28 |
# Language Model pipeline
|
| 29 |
def language_model_pipeline(filepath):
|
| 30 |
summarization_pipeline = pipeline(
|
|
@@ -38,22 +39,15 @@ def language_model_pipeline(filepath):
|
|
| 38 |
summarized_text = summary_result[0]['summary_text']
|
| 39 |
return summarized_text
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
st.
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
if st.button("Summarize"):
|
| 50 |
-
filepath = uploaded_file.name
|
| 51 |
-
with open(filepath, "wb") as temp_file:
|
| 52 |
-
temp_file.write(uploaded_file.read())
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
if __name__ == "__main__":
|
| 59 |
-
main()
|
|
|
|
| 25 |
final_text = final_text + text.page_content
|
| 26 |
return final_text
|
| 27 |
|
| 28 |
+
@st.cache_data
|
| 29 |
# Language Model pipeline
|
| 30 |
def language_model_pipeline(filepath):
|
| 31 |
summarization_pipeline = pipeline(
|
|
|
|
| 39 |
summarized_text = summary_result[0]['summary_text']
|
| 40 |
return summarized_text
|
| 41 |
|
| 42 |
+
title = st.title("PDF Summarization using LaMini")
|
| 43 |
+
uploaded_file = st.file_uploader("Upload your PDF file", type=['pdf'])
|
| 44 |
+
st.success("File Uploaded")
|
| 45 |
+
if uploaded_file is not None:
|
| 46 |
+
if st.button("Summarize"):
|
| 47 |
+
filepath = uploaded_file.name
|
| 48 |
+
with open(filepath, "wb") as temp_file:
|
| 49 |
+
temp_file.write(uploaded_file.read())
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
summarized_result = language_model_pipeline(filepath)
|
| 52 |
+
st.info("Summarization Complete")
|
| 53 |
+
st.success(summarized_result)
|
|
|
|
|
|
|
|
|