Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import os
|
|
4 |
from openai import OpenAI
|
5 |
|
6 |
headers = {
|
7 |
-
"User-
|
8 |
}
|
9 |
|
10 |
proxies = {"http": os.getenv("HTTP_PROXY")}
|
@@ -13,17 +13,18 @@ proxies = {"http": os.getenv("HTTP_PROXY")}
|
|
13 |
def extract_text_from_api(query):
|
14 |
url = "https://fastapi-example-uqyy.onrender.com/extract_text"
|
15 |
headers = {
|
16 |
-
"
|
17 |
}
|
18 |
|
19 |
params = {
|
20 |
-
"query": query
|
|
|
21 |
}
|
22 |
|
23 |
response = requests.get(url, headers=headers, proxies=proxies, params=params)
|
24 |
|
25 |
if response.status_code == 200:
|
26 |
-
return response.json().get("
|
27 |
else:
|
28 |
return ""
|
29 |
|
@@ -32,7 +33,7 @@ def get_summary(text):
|
|
32 |
client = OpenAI(api_key='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')
|
33 |
|
34 |
completion = client.chat.completions.create(
|
35 |
-
model="gpt-
|
36 |
messages=[
|
37 |
{"role": "system", "content": '''You are a law professor specialized in legal writing and legal research.
|
38 |
When presented with a case by a user please summarize it according to the following requirements:
|
@@ -54,7 +55,7 @@ def get_summary(text):
|
|
54 |
|
55 |
st.write("\n")
|
56 |
st.write("\n")
|
57 |
-
search_query = st.text_input("Enter the case query, e.g., '
|
58 |
|
59 |
if search_query:
|
60 |
with st.spinner("Extracting text from case..."):
|
|
|
4 |
from openai import OpenAI
|
5 |
|
6 |
headers = {
|
7 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582"
|
8 |
}
|
9 |
|
10 |
proxies = {"http": os.getenv("HTTP_PROXY")}
|
|
|
13 |
def extract_text_from_api(query):
|
14 |
url = "https://fastapi-example-uqyy.onrender.com/extract_text"
|
15 |
headers = {
|
16 |
+
"accept": "application/json"
|
17 |
}
|
18 |
|
19 |
params = {
|
20 |
+
"query": query,
|
21 |
+
"num_results": 1
|
22 |
}
|
23 |
|
24 |
response = requests.get(url, headers=headers, proxies=proxies, params=params)
|
25 |
|
26 |
if response.status_code == 200:
|
27 |
+
return response.json().get("text", "")
|
28 |
else:
|
29 |
return ""
|
30 |
|
|
|
33 |
client = OpenAI(api_key='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')
|
34 |
|
35 |
completion = client.chat.completions.create(
|
36 |
+
model="gpt-4",
|
37 |
messages=[
|
38 |
{"role": "system", "content": '''You are a law professor specialized in legal writing and legal research.
|
39 |
When presented with a case by a user please summarize it according to the following requirements:
|
|
|
55 |
|
56 |
st.write("\n")
|
57 |
st.write("\n")
|
58 |
+
search_query = st.text_input("Enter the case query, e.g., 'Google oracle supreme'")
|
59 |
|
60 |
if search_query:
|
61 |
with st.spinner("Extracting text from case..."):
|