Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -66,7 +66,10 @@ def getstuff(openapikey,category_selector):
|
|
66 |
jsonextract=pattern.findall(response.response)[0]
|
67 |
#print("json extract\n",jsonextract)
|
68 |
df_tmp=pd.read_json(jsonextract)
|
69 |
-
|
|
|
|
|
|
|
70 |
except:
|
71 |
df=pd.DataFrame()
|
72 |
df['message']=['Data insufficient to decipher']
|
@@ -81,7 +84,7 @@ def getstuff(openapikey,category_selector):
|
|
81 |
with gr.Blocks() as demo:
|
82 |
gr.Markdown("<h1><center>ChatGPT Stock News Snapshots</center></h1>")
|
83 |
gr.Markdown(
|
84 |
-
"""What are the sectors with positive momentum? What are the macro trends? Which companies have momentum? Sector summaries 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. This demonstrates 'Chain of Thought' thinking using ChatGPT.\n\nNote: llama-index & gpt-3.5-turbo are used. The analysis takes roughly 120 secs & may not always be consistent. If ChatGPT API is overloaded you will get an error\n ![visitors](https://visitor-badge.glitch.me/badge?page_id=hra.chatgpt-stock-news-snapshots)"""
|
85 |
)
|
86 |
|
87 |
with gr.Row() as row:
|
|
|
66 |
jsonextract=pattern.findall(response.response)[0]
|
67 |
#print("json extract\n",jsonextract)
|
68 |
df_tmp=pd.read_json(jsonextract)
|
69 |
+
if len(df_tmp.columns)<=1:
|
70 |
+
df=pd.DataFrame(df_tmp[df_tmp.columns[0]].tolist())
|
71 |
+
else:
|
72 |
+
df=df_tmp
|
73 |
except:
|
74 |
df=pd.DataFrame()
|
75 |
df['message']=['Data insufficient to decipher']
|
|
|
84 |
with gr.Blocks() as demo:
|
85 |
gr.Markdown("<h1><center>ChatGPT Stock News Snapshots</center></h1>")
|
86 |
gr.Markdown(
|
87 |
+
"""What are the sectors with positive momentum? What are the macro trends? Which companies have momentum? Sector summaries 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. This demonstrates 'Chain of Thought' thinking using ChatGPT.\n4 snapshots are provided for illustration (trends, sector outlook, news summary email, macro trends email\n\nNote: llama-index & gpt-3.5-turbo are used. The analysis takes roughly 120 secs & may not always be consistent. If ChatGPT API is overloaded you will get an error\n ![visitors](https://visitor-badge.glitch.me/badge?page_id=hra.chatgpt-stock-news-snapshots)"""
|
88 |
)
|
89 |
|
90 |
with gr.Row() as row:
|