Rehan3024 commited on
Commit
393ec5b
·
verified ·
1 Parent(s): f67adf9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -3,6 +3,7 @@ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, AutoModelForQuest
3
  from sentence_transformers import SentenceTransformer
4
  import fitz # PyMuPDF
5
  import os
 
6
 
7
  # Load the models
8
  summarization_model_name = 'facebook/bart-large-cnn'
@@ -35,7 +36,7 @@ def get_answer(question, context):
35
  answer_end = torch.argmax(end_positions) + 1
36
  answer = qa_tokenizer.convert_tokens_to_string(qa_tokenizer.convert_ids_to_tokens(inputs["input_ids"][0][answer_start:answer_end]))
37
  return answer
38
-
39
  # Streamlit app
40
  st.title("PDF Summarizer and Q&A")
41
  st.write("Upload a PDF file to get a summary and ask questions about the content.")
 
3
  from sentence_transformers import SentenceTransformer
4
  import fitz # PyMuPDF
5
  import os
6
+ import torch # Import torch module
7
 
8
  # Load the models
9
  summarization_model_name = 'facebook/bart-large-cnn'
 
36
  answer_end = torch.argmax(end_positions) + 1
37
  answer = qa_tokenizer.convert_tokens_to_string(qa_tokenizer.convert_ids_to_tokens(inputs["input_ids"][0][answer_start:answer_end]))
38
  return answer
39
+
40
  # Streamlit app
41
  st.title("PDF Summarizer and Q&A")
42
  st.write("Upload a PDF file to get a summary and ask questions about the content.")