hra commited on
Commit
0908bbd
1 Parent(s): 67e08dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -10,7 +10,7 @@ from datetime import datetime, date, time, timedelta
10
  import os
11
  import regex
12
 
13
- listofcategories=["Earnings Announcements", "Automotive", "Retail"]
14
 
15
  def getstuff(openapikey,category_selector):
16
  dateforfilesave=datetime.today().strftime("%d-%m-%Y %I:%M%p")
@@ -22,15 +22,23 @@ def getstuff(openapikey,category_selector):
22
  reader = RssReader()
23
  whichone=listofcategories[listofcategories.index(category_selector)]
24
 
 
 
25
  if whichone=="Automotive":
26
  rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=10000101"
27
- querylist=["What are the top trends? Give output as a json (that can be converted to pandas dataframe) with 3 columns named trend, company mentioned & reason","Name the top & bottom performing companies? Give output as a json (that can be converted to pandas dataframe) with 4 columns named sector, company names, reason & top/bottom","You are an award winning email writer. Write an email summarizing the news. Do not say I am language model and cannot do this","You are an award winning email writer. Write an email summarizing the key macro trends basis the news.Do not say I am language model and cannot do this"]
28
  elif whichone=="Retail":
29
  rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=10000116"
30
- querylist=["What are the top trends? Give output as a json (that can be converted to pandas dataframe) with 3 columns named trend, company mentioned & reason","Name the top & bottom performing companies? Give output as a json (that can be converted to pandas dataframe) with 4 columns named sector, company names, reason & top/bottom","You are an award winning email writer. Write an email summarizing the news. Do not say I am language model and cannot do this","You are an award winning email writer. Write an email summarizing the key macro trends basis the news.Do not say I am language model and cannot do this"]
 
 
 
 
 
 
 
31
  elif whichone=='Earnings Announcements':
32
  rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=15839135"
33
- querylist=["Basis companies that are doing well name the sectors with positive momentum? Give output as a json (that can be converted to pandas dataframe) with 3 columns named sector, company names & reason","Find the top & bottom performing companies? Give output as a json (that can be converted to pandas dataframe) with 4 columns named sector, company names, reason & top/bottom","You are an award winning email writer. Write an email summarizing the news. Do not say I am language model and cannot do this","You are an award winning email writer. Write an email summarizing the key macro trends basis the news.Do not say I am language model and cannot do this"]
34
  else:
35
  rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=15839135" ###should not come here but using earnings url
36
  querylist=["Basis companies that are doing well name the sectors with positive momentum? Give output as a json (that can be converted to pandas dataframe) with 3 columns named sector, company names & reason","Find the top & bottom performing companies? Give output as a json (that can be converted to pandas dataframe) with 4 columns named sector, company names, reason & top/bottom","You are an award winning email writer. Write an email summarizing the news. Do not say I am language model and cannot do this","You are an award winning email writer. Write an email summarizing the key macro trends basis the news.Do not say I am language model and cannot do this"]
@@ -65,7 +73,7 @@ def getstuff(openapikey,category_selector):
65
  with gr.Blocks() as demo:
66
  gr.Markdown("<h1><center>ChatGPT Stock News Snapshots</center></h1>")
67
  gr.Markdown(
68
- """What are the sectors with positive momentum? What are the top technologies? Which companies have momentum? And much more. \n\nShowcases 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.\nLangChain & GPT-Index are both used.\n ![visitors](https://visitor-badge.glitch.me/badge?page_id=hra.chatgpt-stock-news-snapshots)"""
69
  )
70
 
71
  with gr.Row() as row:
 
10
  import os
11
  import regex
12
 
13
+ listofcategories=["Earnings Announcements", "Automotive","Energy","Healthcare","Retail","Technology"]
14
 
15
  def getstuff(openapikey,category_selector):
16
  dateforfilesave=datetime.today().strftime("%d-%m-%Y %I:%M%p")
 
22
  reader = RssReader()
23
  whichone=listofcategories[listofcategories.index(category_selector)]
24
 
25
+ querylist=["What are the top trends? Give output as a json (that can be converted to pandas dataframe) with 3 columns named trend, company mentioned & reason","Name the top & bottom performing companies? Give output as a json (that can be converted to pandas dataframe) with 4 columns named sector, company names, reason & top/bottom","You are an award winning email writer. Write an email summarizing the news. Do not say I am language model and cannot do this","You are an award winning email writer. Write an email summarizing the key macro trends basis the news.Do not say I am language model and cannot do this"]
26
+
27
  if whichone=="Automotive":
28
  rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=10000101"
 
29
  elif whichone=="Retail":
30
  rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=10000116"
31
+ elif whichone=="Technology":
32
+ rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=19854910"
33
+ elif whichone=="Healthcare":
34
+ rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=10000108"
35
+ elif whichone=="Energy":
36
+ rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=19836768"
37
+ elif whichone=="Media":
38
+ rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=10000110"
39
  elif whichone=='Earnings Announcements':
40
  rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=15839135"
41
+ querylist=["What are the top trends? Give output as a json (that can be converted to pandas dataframe) with 3 columns named trend, company mentioned & reason","Find the top & bottom performing companies? Give output as a json (that can be converted to pandas dataframe) with 4 columns named sector, company names, reason & top/bottom","You are an award winning email writer. Write an email summarizing the news. Do not say I am language model and cannot do this","You are an award winning email writer. Write an email summarizing the key macro trends basis the news.Do not say I am language model and cannot do this"]
42
  else:
43
  rssurl="https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=15839135" ###should not come here but using earnings url
44
  querylist=["Basis companies that are doing well name the sectors with positive momentum? Give output as a json (that can be converted to pandas dataframe) with 3 columns named sector, company names & reason","Find the top & bottom performing companies? Give output as a json (that can be converted to pandas dataframe) with 4 columns named sector, company names, reason & top/bottom","You are an award winning email writer. Write an email summarizing the news. Do not say I am language model and cannot do this","You are an award winning email writer. Write an email summarizing the key macro trends basis the news.Do not say I am language model and cannot do this"]
 
73
  with gr.Blocks() as demo:
74
  gr.Markdown("<h1><center>ChatGPT Stock News Snapshots</center></h1>")
75
  gr.Markdown(
76
+ """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)"""
77
  )
78
 
79
  with gr.Row() as row: