Johan713 commited on
Commit
23d9037
·
verified ·
1 Parent(s): d4b39ae

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +9 -3
app2.py CHANGED
@@ -516,7 +516,7 @@ def comprehensive_document_analysis(content: str) -> Dict[str, Any]:
516
  analysis_prompt = f"Analyze the following legal document and provide a summary, potential issues, and key clauses:\n\n{content}"
517
  document_analysis = get_ai_response(analysis_prompt)
518
 
519
- topic_extraction_prompt = f"Extract the main topics or keywords from the following document summary:\n\n{document_analysis}"
520
  topics = get_ai_response(topic_extraction_prompt)
521
 
522
  web_results = search_web(topics)
@@ -594,6 +594,7 @@ def find_case_precedents(case_details: str) -> Dict[str, Any]:
594
 
595
  Provide a well-structured summary highlighting the most relevant precedents and legal principles
596
  Do not introduce any hypothetical scenarios.
 
597
  """
598
 
599
  summary = get_ai_response(compilation_prompt)
@@ -857,7 +858,9 @@ def analyze_contract(contract_text: str) -> Dict[str, Any]:
857
 
858
  def contract_analysis_ui():
859
  st.subheader("Contract Analyzer")
860
-
 
 
861
  uploaded_file = st.file_uploader(
862
  "Upload a contract document (PDF, DOCX, or TXT)",
863
  type=["pdf", "docx", "txt"],
@@ -1920,7 +1923,10 @@ if feature == "Legal Chatbot":
1920
 
1921
  elif feature == "Document Analysis":
1922
  st.subheader("Legal Document Analyzer")
1923
-
 
 
 
1924
  uploaded_file = st.file_uploader("Upload a legal document (PDF, DOCX, or TXT)", type=["pdf", "docx", "txt"])
1925
 
1926
  if uploaded_file and st.button("Analyze Document"):
 
516
  analysis_prompt = f"Analyze the following legal document and provide a summary, potential issues, and key clauses:\n\n{content}"
517
  document_analysis = get_ai_response(analysis_prompt)
518
 
519
+ topic_extraction_prompt = f"Extract the main topics or keywords from the following document summary relevant for web search and wikipedia search related to the document:\n\n{document_analysis}"
520
  topics = get_ai_response(topic_extraction_prompt)
521
 
522
  web_results = search_web(topics)
 
594
 
595
  Provide a well-structured summary highlighting the most relevant precedents and legal principles
596
  Do not introduce any hypothetical scenarios.
597
+ And if the information from web, wikipedia and case details are not available then ask the user reframe their prompt and resubmit the prompt and also generate a case summary based on the cases that have happened before based on the data you are trained on and do not include and of the hypothical data or fiction data and also tell the user that this summary is generated based on the data falcon 180B is trained on
598
  """
599
 
600
  summary = get_ai_response(compilation_prompt)
 
858
 
859
  def contract_analysis_ui():
860
  st.subheader("Contract Analyzer")
861
+ with st.expander("How to use"):
862
+ st.write('''upload the file and click on analyse contract it will generate analysis of that analysis.''')
863
+ st.warning("Do not upload too big files as it might end up consuming all the tokens and the response generattion will take too much time")
864
  uploaded_file = st.file_uploader(
865
  "Upload a contract document (PDF, DOCX, or TXT)",
866
  type=["pdf", "docx", "txt"],
 
1923
 
1924
  elif feature == "Document Analysis":
1925
  st.subheader("Legal Document Analyzer")
1926
+ with st.expander("How to use"):
1927
+ st.write('''upload the file and it will generate analysis of that document.''')
1928
+ st.warning("Do not upload too big files as it might end up consuming all the tokens and the response generattion will take too much time")
1929
+ if 'precedents' not in st.session_state:
1930
  uploaded_file = st.file_uploader("Upload a legal document (PDF, DOCX, or TXT)", type=["pdf", "docx", "txt"])
1931
 
1932
  if uploaded_file and st.button("Analyze Document"):