Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,8 @@ import requests
|
|
4 |
import os
|
5 |
import anthropic
|
6 |
from anthropic import Anthropic, HUMAN_PROMPT, AI_PROMPT
|
7 |
-
from io import StringIO
|
8 |
-
import time
|
9 |
-
from io import BytesIO
|
10 |
|
11 |
|
12 |
client = anthropic.Anthropic(
|
@@ -96,8 +95,6 @@ search_query = st.text_input("case name, e.g. brown v board supreme, 372 US 335,
|
|
96 |
|
97 |
if search_query:
|
98 |
with st.spinner("Searching for cases..."):
|
99 |
-
st.write(text)
|
100 |
-
|
101 |
results = search_legal_cases(search_query)
|
102 |
if results:
|
103 |
title, link, citation = results[0]
|
@@ -106,17 +103,13 @@ if search_query:
|
|
106 |
st.write("Citation:\n", citation)
|
107 |
with st.spinner("Extracting text from case..."):
|
108 |
text = extract_text_from_link(link)
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
else:
|
111 |
st.write("No results found.")
|
112 |
-
|
113 |
-
|
114 |
-
if search_query:
|
115 |
-
with st.spinner("Generating summary..."):
|
116 |
-
summary = get_summary(text)
|
117 |
-
st.write(summary)
|
118 |
-
|
119 |
-
|
120 |
-
# Convert the response to a file-like object for download
|
121 |
-
download_bytes = BytesIO(summary.encode())
|
122 |
-
st.download_button("Download the results", download_bytes, "summary.txt", "text/plain")
|
|
|
4 |
import os
|
5 |
import anthropic
|
6 |
from anthropic import Anthropic, HUMAN_PROMPT, AI_PROMPT
|
7 |
+
from io import StringIO, BytesIO
|
8 |
+
import time
|
|
|
9 |
|
10 |
|
11 |
client = anthropic.Anthropic(
|
|
|
95 |
|
96 |
if search_query:
|
97 |
with st.spinner("Searching for cases..."):
|
|
|
|
|
98 |
results = search_legal_cases(search_query)
|
99 |
if results:
|
100 |
title, link, citation = results[0]
|
|
|
103 |
st.write("Citation:\n", citation)
|
104 |
with st.spinner("Extracting text from case..."):
|
105 |
text = extract_text_from_link(link)
|
106 |
+
st.write(text) # Optionally display the extracted text
|
107 |
+
with st.spinner("Generating summary..."):
|
108 |
+
summary = get_summary(text)
|
109 |
+
st.write(summary)
|
110 |
+
|
111 |
+
# Convert the response to a file-like object for download
|
112 |
+
download_bytes = BytesIO(summary.encode())
|
113 |
+
st.download_button("Download the results", download_bytes, "summary.txt", "text/plain")
|
114 |
else:
|
115 |
st.write("No results found.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|