Johan713 commited on
Commit
609ee7c
·
verified ·
1 Parent(s): 3bbf2dc

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +42 -22
app2.py CHANGED
@@ -581,7 +581,8 @@ def find_case_precedents(case_details: str) -> Dict[str, Any]:
581
 
582
  # Compile all information
583
  compilation_prompt = f"""
584
- Analyze and summarize the following case law information, focusing solely on factual elements and legal principles. Do not include any speculative or fictional content:
 
585
 
586
  Case Details: {case_details}
587
 
@@ -1707,8 +1708,8 @@ elif feature == "Case Precedent Finder":
1707
  if 'precedents' not in st.session_state:
1708
  st.session_state.precedents = None
1709
 
1710
- case_details = st.text_area("Enter case details:")
1711
- if st.button("Find Precedents"):
1712
  with st.spinner("Searching for relevant case precedents..."):
1713
  try:
1714
  st.session_state.precedents = find_case_precedents(case_details)
@@ -1718,32 +1719,51 @@ elif feature == "Case Precedent Finder":
1718
  if st.session_state.precedents:
1719
  precedents = st.session_state.precedents
1720
 
1721
- st.write("### Summary of Relevant Case Precedents")
1722
- st.markdown(precedents["summary"])
1723
 
1724
- st.write("### Related Cases from Public Databases")
1725
  for i, case in enumerate(precedents["public_cases"], 1):
1726
- with st.expander(f"{i}. {case['case_name']}"):
1727
- st.write(f"**Source:** {case['source']}")
1728
- st.write(f"**Case Name:** {case['case_name']}")
1729
- st.write(f"**URL:** [{case['url']}]({case['url']})")
1730
-
1731
- # Display all available fields without conditionals
1732
  for field in ['summary', 'date_filed', 'docket_number', 'court']:
1733
  if field in case and case[field]:
1734
- st.write(f"**{field.replace('_', ' ').title()}:** {case[field]}")
 
1735
 
1736
- st.write("### Additional Web Results")
1737
  for i, result in enumerate(precedents["web_results"], 1):
1738
- with st.expander(f"{i}. {result['title']}"):
1739
- st.write(f"**Source:** [{result['link']}]({result['link']})")
1740
- st.write(f"**Snippet:** {result['snippet']}")
 
1741
 
1742
- st.write("### Wikipedia Information")
1743
- wiki_info = precedents["wikipedia"]
1744
- with st.expander(f"Wikipedia: {wiki_info['title']}"):
1745
- st.markdown(wiki_info['summary'])
1746
- st.write(f"[Read more on Wikipedia]({wiki_info['url']})")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1747
 
1748
  elif feature == "Legal Cost Estimator":
1749
  legal_cost_estimator_ui()
 
581
 
582
  # Compile all information
583
  compilation_prompt = f"""
584
+ Analyze the following case details and identify key legal concepts and relevant precedents,
585
+ Analyze and the following case law information, focusing solely on factual elements and legal principles. Do not include any speculative or fictional content:
586
 
587
  Case Details: {case_details}
588
 
 
1708
  if 'precedents' not in st.session_state:
1709
  st.session_state.precedents = None
1710
 
1711
+ case_details = st.text_area("Enter case details:", height=100)
1712
+ if st.button("Find Precedents", type="primary"):
1713
  with st.spinner("Searching for relevant case precedents..."):
1714
  try:
1715
  st.session_state.precedents = find_case_precedents(case_details)
 
1719
  if st.session_state.precedents:
1720
  precedents = st.session_state.precedents
1721
 
1722
+ st.markdown("## Summary of Relevant Case Precedents")
1723
+ st.info(precedents["summary"])
1724
 
1725
+ st.markdown("## Related Cases from Public Databases")
1726
  for i, case in enumerate(precedents["public_cases"], 1):
1727
+ st.markdown(f"### {i}. {case['case_name']}")
1728
+ col1, col2 = st.columns([1, 2])
1729
+ with col1:
1730
+ st.markdown(f"**Source:** {case['source']}")
1731
+ st.markdown(f"**URL:** [View Case]({case['url']})")
1732
+ with col2:
1733
  for field in ['summary', 'date_filed', 'docket_number', 'court']:
1734
  if field in case and case[field]:
1735
+ st.markdown(f"**{field.replace('_', ' ').title()}:** {case[field]}")
1736
+ st.markdown("---")
1737
 
1738
+ st.markdown("## Additional Web Results")
1739
  for i, result in enumerate(precedents["web_results"], 1):
1740
+ st.markdown(f"### {i}. {result['title']}")
1741
+ st.markdown(f"**Source:** [{result['link']}]({result['link']})")
1742
+ st.markdown(f"**Snippet:** {result['snippet']}")
1743
+ st.markdown("---")
1744
 
1745
+ st.markdown("## Wikipedia Information")
1746
+ st.markdown(f"### {wiki_info['title']}")
1747
+ st.markdown(wiki_info['summary'])
1748
+ st.markdown(f"[Read more on Wikipedia]({wiki_info['url']})")
1749
+
1750
+ st.markdown(
1751
+ """
1752
+ <style>
1753
+ .stButton > button {
1754
+ width: 100%;
1755
+ }
1756
+ .stTextArea > div > div > textarea {
1757
+ font-size: 16px;
1758
+ }
1759
+ h1, h2, h3 {
1760
+ margin-top: 1em;
1761
+ margin-bottom: 0.5em;
1762
+ }
1763
+ </style>
1764
+ """,
1765
+ unsafe_allow_html=True
1766
+ )
1767
 
1768
  elif feature == "Legal Cost Estimator":
1769
  legal_cost_estimator_ui()