Rajagopal commited on
Commit
2275cf7
·
1 Parent(s): 4fe6e77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -6
app.py CHANGED
@@ -25,29 +25,59 @@ llm = AzureChatOpenAI(
25
 
26
 
27
 
28
- st.title("Contract Management System")
 
29
 
30
  # description text
31
- st.write("""Hello! I'm an Al chatbot specifically created to assist vou with any procurement-related questions you may have. My range of capabilities includes providing information on contract expiry dates payment terms, and other relevant details.
 
 
32
 
33
- Feel free to ask me anything you need help with!
34
- To get started, just provide me with the contract number and let me know what specitic details you're interested in. Additionally, tee tree to ask me any general questions you may have regardinc procurement. I'm here to assist vou in any way can 😊""")
35
 
36
  # pdf file upload
37
  pdf_file = st.file_uploader("Upload file", type=["pdf"])
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  def extract_text_from_pdf():
41
  reader = PdfReader(pdf_file)
42
  # get all pages text
43
- text = [reader.pages[i].extract_text() for i in range(len(reader.pages))]
44
  # join all pages text
45
  text = " ".join(text)
46
  return text
47
 
48
 
 
 
 
 
 
 
 
49
 
50
- if st.button("Summerize Contract"):
51
  with st.spinner("Extracting Text..."):
52
  summary_chain = load_summarize_chain(llm, chain_type="map_reduce")
53
  summarize_document_chain = AnalyzeDocumentChain(combine_docs_chain=summary_chain, verbose=True)
@@ -55,3 +85,4 @@ if st.button("Summerize Contract"):
55
  with st.spinner("Summarizing..."):
56
  result = summarize_document_chain.run(text)
57
  st.write(result)
 
 
25
 
26
 
27
 
28
+
29
+ st.title("Wipro CSRD AI 1")
30
 
31
  # description text
32
+ st.write("Step 1: Summary of your selected section of CSRD... Sections in this are enviormental topic1, enviornamtal topic2 ")
33
+ st.write("Step 2: Ask your specfici questions regarding a CSRD disclosure requirments")
34
+
35
 
 
 
36
 
37
  # pdf file upload
38
  pdf_file = st.file_uploader("Upload file", type=["pdf"])
39
 
40
+ numberofpages = 100
41
+
42
+ if st.button("How many pages? "):
43
+ reader = PdfReader(pdf_file)
44
+ numberofpages = len(reader.pages)
45
+ st.write("length is ", numberofpages)
46
+
47
+ if st.button("table of contents? "):
48
+ reader = PdfReader(pdf_file)
49
+ page = reader.pages[2].extract_text()
50
+ st.write(page)
51
+
52
+
53
+
54
+
55
+ startpage = st.slider('Which section to look at', 0, numberofpages, 1)
56
+ st.write("starting section page", startpage)
57
+
58
+
59
+ pagecount = st.slider('How many pages', 1, 5, 1)
60
+ st.write("pages to read", pagecount)
61
+
62
 
63
  def extract_text_from_pdf():
64
  reader = PdfReader(pdf_file)
65
  # get all pages text
66
+ text = [reader.pages[i].extract_text() for i in range(startpage, startpage + pagecount )]
67
  # join all pages text
68
  text = " ".join(text)
69
  return text
70
 
71
 
72
+ def extract_text_from_pdf2():
73
+ reader = PdfReader(pdf_file)
74
+ # get all pages text
75
+ text = [reader.pages[i].extract_text() for i in range(len(reader.pages))]
76
+ # join all pages text
77
+ text = " ".join(text)
78
+ return text
79
 
80
+ if st.button("Summerize "):
81
  with st.spinner("Extracting Text..."):
82
  summary_chain = load_summarize_chain(llm, chain_type="map_reduce")
83
  summarize_document_chain = AnalyzeDocumentChain(combine_docs_chain=summary_chain, verbose=True)
 
85
  with st.spinner("Summarizing..."):
86
  result = summarize_document_chain.run(text)
87
  st.write(result)
88
+