Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -77,9 +77,9 @@ def getstuff(openapikey,category_selector,ticker_input):
|
|
77 |
|
78 |
# Create a loop to go through each section type and save only the 10-K section in the dictionary
|
79 |
for doc_type, doc_start, doc_end in zip(doc_types, doc_start_is, doc_end_is):
|
80 |
-
if doc_type ==
|
81 |
document[doc_type] = raw_10k[doc_start:doc_end]
|
82 |
-
item_content = BeautifulSoup(document[
|
83 |
|
84 |
filetextcontentlist.append(str(item_content.text.encode('ascii','ignore')))
|
85 |
|
@@ -94,7 +94,7 @@ def getstuff(openapikey,category_selector,ticker_input):
|
|
94 |
documents=[Document(t) for t in newlist]
|
95 |
index = GPTSimpleVectorIndex.from_documents(documents)
|
96 |
print('Came here4')
|
97 |
-
querylist=['What are the main products/ services mentioned?','What are the major risks?',"What are the top investment focus areas?","What is the financial outlook of the company?"]
|
98 |
|
99 |
|
100 |
|
@@ -128,7 +128,7 @@ def getstuff(openapikey,category_selector,ticker_input):
|
|
128 |
df['action']=['try again in a few hours']
|
129 |
answerlist.append(df)
|
130 |
else:
|
131 |
-
answerlist.append(response.response)
|
132 |
|
133 |
print('Came to return statement')
|
134 |
return answerlist
|
@@ -161,8 +161,13 @@ with gr.Blocks() as demo:
|
|
161 |
output3 = gr.Textbox(placeholder='', lines=4,label='Snapshot 3')
|
162 |
with gr.Column():
|
163 |
output4 = gr.Textbox(placeholder='', lines=4,label='Snapshot 4')
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
|
168 |
demo.launch(debug=True)
|
|
|
77 |
|
78 |
# Create a loop to go through each section type and save only the 10-K section in the dictionary
|
79 |
for doc_type, doc_start, doc_end in zip(doc_types, doc_start_is, doc_end_is):
|
80 |
+
if doc_type == category_selector:
|
81 |
document[doc_type] = raw_10k[doc_start:doc_end]
|
82 |
+
item_content = BeautifulSoup(document[category_selector], 'lxml')
|
83 |
|
84 |
filetextcontentlist.append(str(item_content.text.encode('ascii','ignore')))
|
85 |
|
|
|
94 |
documents=[Document(t) for t in newlist]
|
95 |
index = GPTSimpleVectorIndex.from_documents(documents)
|
96 |
print('Came here4')
|
97 |
+
querylist=['What are the main products/ services mentioned?','What are the major risks?',"What are the top investment focus areas?","What is the financial outlook of the company?","What key technologies like AI, blockchain etc are mentioned?","What other company names/ competitors are mentioned?"]
|
98 |
|
99 |
|
100 |
|
|
|
128 |
df['action']=['try again in a few hours']
|
129 |
answerlist.append(df)
|
130 |
else:
|
131 |
+
answerlist.append(querylist[i]+'\n'+response.response)
|
132 |
|
133 |
print('Came to return statement')
|
134 |
return answerlist
|
|
|
161 |
output3 = gr.Textbox(placeholder='', lines=4,label='Snapshot 3')
|
162 |
with gr.Column():
|
163 |
output4 = gr.Textbox(placeholder='', lines=4,label='Snapshot 4')
|
164 |
+
with gr.Row() as row:
|
165 |
+
with gr.Column():
|
166 |
+
output5 = gr.Textbox(placeholder='', lines=4,label='Snapshot 5')
|
167 |
+
with gr.Column():
|
168 |
+
output6 = gr.Textbox(placeholder='', lines=4,label='Snapshot 6')
|
169 |
+
|
170 |
+
btn.click(getstuff, inputs=[textboxopenapi,category_selector,input1],outputs=[output1,output2,output3,output4,output5,output6])
|
171 |
|
172 |
|
173 |
demo.launch(debug=True)
|