Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -29,16 +29,16 @@ def getstuff(openapikey,category_selector,ticker_input,user_question):
|
|
29 |
print(user_question)
|
30 |
print(dateforfilesave)
|
31 |
if openapikey=='':
|
32 |
-
return ["Please provide OpenAPI Key","Please provide OpenAPI Key","Please provide OpenAPI Key","Please provide OpenAPI Key","Please provide OpenAPI Key","Please provide OpenAPI Key",]
|
33 |
|
34 |
os.environ['OPENAI_API_KEY'] = str(openapikey)
|
35 |
|
36 |
if category_selector=='10-K':
|
37 |
num_filings_needed=1
|
38 |
elif category_selector=='8-K':
|
39 |
-
num_filings_needed=8
|
40 |
-
elif category_selector=='10-Q':
|
41 |
num_filings_needed=4
|
|
|
|
|
42 |
else:
|
43 |
num_filings_needed=1
|
44 |
filings_temp=get_filing_urls_to_download(category_selector, ticker_input,num_filings_to_download=num_filings_needed,include_amends=False,before_date='2023-04-01',after_date='2022-01-01')
|
@@ -132,7 +132,7 @@ def getstuff(openapikey,category_selector,ticker_input,user_question):
|
|
132 |
df['action']=['try again in a few hours']
|
133 |
answerlist.append(df)
|
134 |
else:
|
135 |
-
answerlist.append(querylist[i]+'\n'+response.response)
|
136 |
|
137 |
print('Came to return statement')
|
138 |
return answerlist
|
@@ -140,7 +140,7 @@ def getstuff(openapikey,category_selector,ticker_input,user_question):
|
|
140 |
with gr.Blocks() as demo:
|
141 |
gr.Markdown("<h1><center>ChatGPT SEC Filings Question Answers</center></h1>")
|
142 |
gr.Markdown(
|
143 |
-
"""What are the products & services? What are the risks? What is the outlook? and much more. \n\nThis is a demo & showcases ChatGPT integrated with real data. It shows how to get real-time data and marry it with ChatGPT capabilities
|
144 |
)
|
145 |
|
146 |
with gr.Row() as row:
|
|
|
29 |
print(user_question)
|
30 |
print(dateforfilesave)
|
31 |
if openapikey=='':
|
32 |
+
return ["Please provide OpenAPI Key","Please provide OpenAPI Key","Please provide OpenAPI Key","Please provide OpenAPI Key","Please provide OpenAPI Key","Please provide OpenAPI Key","Please provide OpenAPI Key",]
|
33 |
|
34 |
os.environ['OPENAI_API_KEY'] = str(openapikey)
|
35 |
|
36 |
if category_selector=='10-K':
|
37 |
num_filings_needed=1
|
38 |
elif category_selector=='8-K':
|
|
|
|
|
39 |
num_filings_needed=4
|
40 |
+
elif category_selector=='10-Q':
|
41 |
+
num_filings_needed=2
|
42 |
else:
|
43 |
num_filings_needed=1
|
44 |
filings_temp=get_filing_urls_to_download(category_selector, ticker_input,num_filings_to_download=num_filings_needed,include_amends=False,before_date='2023-04-01',after_date='2022-01-01')
|
|
|
132 |
df['action']=['try again in a few hours']
|
133 |
answerlist.append(df)
|
134 |
else:
|
135 |
+
answerlist.append(querylist[i]+'\n\n'+response.response)
|
136 |
|
137 |
print('Came to return statement')
|
138 |
return answerlist
|
|
|
140 |
with gr.Blocks() as demo:
|
141 |
gr.Markdown("<h1><center>ChatGPT SEC Filings Question Answers</center></h1>")
|
142 |
gr.Markdown(
|
143 |
+
"""What are the products & services? What are the risks? What is the outlook? and much more. \n\nThis is a demo & showcases ChatGPT integrated with real data. It shows how to get real-time data and marry it with ChatGPT capabilities.\n\nMultiple snapshots/ Question-Answers are provided for illustration (products, risks, focus areas, etc)\n\nNote: llama-index & gpt-3.5-turbo are used. The analysis takes more than 1-3 mins & may not always be consistent. If ChatGPT API is overloaded/ no API key is provided/ API quota is over you will get an error\n ![visitors](https://visitor-badge.glitch.me/badge?page_id=hra.ChatGPT-SEC-Docs-QA)"""
|
144 |
)
|
145 |
|
146 |
with gr.Row() as row:
|