nurindahpratiwi commited on
Commit
18ef4de
1 Parent(s): 68e9191
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -18,6 +18,7 @@ custom_html = """
18
  }
19
  .banner img {
20
  width: 100%;
 
21
  object-fit: cover;
22
  }
23
  </style>
@@ -43,12 +44,12 @@ def preprocess_pdf(file):
43
  return final_text
44
 
45
  # Language Model pipeline
46
- def language_model_pipeline(filepath):
47
  summarization_pipeline = pipeline(
48
  'summarization',
49
  model=model,
50
  tokenizer=model_tokenizer,
51
- max_length=500,
52
  min_length=70)
53
  input_text = preprocess_pdf(filepath)
54
  summary_result = summarization_pipeline(input_text)
@@ -71,6 +72,7 @@ def main():
71
  st.title("PDF Summarization App using Language Model")
72
 
73
  uploaded_file = st.file_uploader("Upload your PDF file", type=['pdf'])
 
74
 
75
  if uploaded_file is not None:
76
  if st.button("Summarize"):
@@ -83,7 +85,7 @@ def main():
83
  pdf_view = display_pdf(filepath)
84
 
85
  with col2:
86
- summarized_result = language_model_pipeline(filepath)
87
  st.info("Summarization Complete")
88
  st.success(summarized_result)
89
 
 
18
  }
19
  .banner img {
20
  width: 100%;
21
+ height: 200px;
22
  object-fit: cover;
23
  }
24
  </style>
 
44
  return final_text
45
 
46
  # Language Model pipeline
47
+ def language_model_pipeline(filepath, maxlength):
48
  summarization_pipeline = pipeline(
49
  'summarization',
50
  model=model,
51
  tokenizer=model_tokenizer,
52
+ max_length=maxlength,
53
  min_length=70)
54
  input_text = preprocess_pdf(filepath)
55
  summary_result = summarization_pipeline(input_text)
 
72
  st.title("PDF Summarization App using Language Model")
73
 
74
  uploaded_file = st.file_uploader("Upload your PDF file", type=['pdf'])
75
+ maxlength = st.number_input("Max token", min_value=1, max_value=10, value=5, step=1)
76
 
77
  if uploaded_file is not None:
78
  if st.button("Summarize"):
 
85
  pdf_view = display_pdf(filepath)
86
 
87
  with col2:
88
+ summarized_result = language_model_pipeline(filepath, maxlength)
89
  st.info("Summarization Complete")
90
  st.success(summarized_result)
91