nurindahpratiwi
commited on
Commit
·
ffd082a
1
Parent(s):
149d18b
fix line
Browse files
app.py
CHANGED
@@ -25,10 +25,8 @@ def preprocess_pdf(file):
|
|
25 |
final_text = final_text + text.page_content
|
26 |
return final_text
|
27 |
|
28 |
-
maxlength = st.number_input("Length of token", min_value=32, max_value=1024, step=32, placeholder="Type a number (min 32)...")
|
29 |
-
|
30 |
# Language Model pipeline
|
31 |
-
def language_model_pipeline(filepath):
|
32 |
summarization_pipeline = pipeline(
|
33 |
'summarization',
|
34 |
model=model,
|
@@ -51,8 +49,8 @@ def display_pdf(file):
|
|
51 |
|
52 |
def main():
|
53 |
st.title("PDF Summarization App using Language Model")
|
54 |
-
|
55 |
uploaded_file = st.file_uploader("Upload your PDF file", type=['pdf'])
|
|
|
56 |
|
57 |
if uploaded_file is not None:
|
58 |
if st.button("Summarize"):
|
@@ -64,7 +62,7 @@ def main():
|
|
64 |
st.success("File Uploaded")
|
65 |
|
66 |
with col2:
|
67 |
-
summarized_result = language_model_pipeline(filepath)
|
68 |
st.info("Summarization Complete")
|
69 |
st.success(summarized_result)
|
70 |
|
|
|
25 |
final_text = final_text + text.page_content
|
26 |
return final_text
|
27 |
|
|
|
|
|
28 |
# Language Model pipeline
|
29 |
+
def language_model_pipeline(filepath, maxlength):
|
30 |
summarization_pipeline = pipeline(
|
31 |
'summarization',
|
32 |
model=model,
|
|
|
49 |
|
50 |
def main():
|
51 |
st.title("PDF Summarization App using Language Model")
|
|
|
52 |
uploaded_file = st.file_uploader("Upload your PDF file", type=['pdf'])
|
53 |
+
maxlength = st.sidebar.slider(label="Token Length", min_value=32, max_value=1024, step=32, value=1024)
|
54 |
|
55 |
if uploaded_file is not None:
|
56 |
if st.button("Summarize"):
|
|
|
62 |
st.success("File Uploaded")
|
63 |
|
64 |
with col2:
|
65 |
+
summarized_result = language_model_pipeline(filepath, maxlength)
|
66 |
st.info("Summarization Complete")
|
67 |
st.success(summarized_result)
|
68 |
|