Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ def getstuff(openapikey,category_selector,ticker_input):
|
|
46 |
filetextcontentlist=[]
|
47 |
for each in files:
|
48 |
headers = {
|
49 |
-
"User-Agent": '
|
50 |
"Accept-Encoding": "gzip, deflate",
|
51 |
"Host": "www.sec.gov",
|
52 |
}
|
@@ -89,7 +89,7 @@ def getstuff(openapikey,category_selector,ticker_input):
|
|
89 |
temp=temp.split('.')
|
90 |
newlist=[]
|
91 |
for each in temp:
|
92 |
-
if len(each.split())>
|
93 |
newlist.append(each)
|
94 |
documents=[Document(t) for t in newlist]
|
95 |
index = GPTSimpleVectorIndex.from_documents(documents)
|
@@ -107,7 +107,7 @@ def getstuff(openapikey,category_selector,ticker_input):
|
|
107 |
print(i,"Query: ",querylist[i])
|
108 |
response = index.query(
|
109 |
querylist[i],
|
110 |
-
|
111 |
response_mode="tree_summarize",
|
112 |
similarity_top_k=min(int(len(documents)/3),20)
|
113 |
)
|
|
|
46 |
filetextcontentlist=[]
|
47 |
for each in files:
|
48 |
headers = {
|
49 |
+
"User-Agent": 'random@yahoo.com',
|
50 |
"Accept-Encoding": "gzip, deflate",
|
51 |
"Host": "www.sec.gov",
|
52 |
}
|
|
|
89 |
temp=temp.split('.')
|
90 |
newlist=[]
|
91 |
for each in temp:
|
92 |
+
if len(each.split())>10: ###eliminate sentences with less words
|
93 |
newlist.append(each)
|
94 |
documents=[Document(t) for t in newlist]
|
95 |
index = GPTSimpleVectorIndex.from_documents(documents)
|
|
|
107 |
print(i,"Query: ",querylist[i])
|
108 |
response = index.query(
|
109 |
querylist[i],
|
110 |
+
service_context=service_context,
|
111 |
response_mode="tree_summarize",
|
112 |
similarity_top_k=min(int(len(documents)/3),20)
|
113 |
)
|