hra commited on
Commit
9c5ac16
1 Parent(s): bc634e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -9
app.py CHANGED
@@ -24,16 +24,16 @@ def getstuff(openapikey,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","Write an email summarizing 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","Write an email summarizing 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","Write an email summarizing 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","Write an email summarizing the news. Do not say I am language model and cannot do this"]
37
 
38
  documents = reader.load_data([rssurl])
39
  index = GPTSimpleVectorIndex(documents)
@@ -71,21 +71,29 @@ with gr.Blocks() as demo:
71
  with gr.Column():
72
  textboxopenapi = gr.Textbox(placeholder="Enter OpenAPI Key...", lines=1,label='OpenAPI Key')
73
  category_selector=gr.Dropdown(
74
- listofcategories, label="Sector", info="Select the snapshot you want..."
75
  )
76
  with gr.Column():
77
- btn = gr.Button("Generate")
78
 
79
  with gr.Row() as row:
80
  table1=gr.Dataframe(
81
  #headers=["Item", "Cost"],
82
- datatype=["str", "str","str"],
83
  label="Snapshot 1",
84
  )
85
  with gr.Row() as row:
86
- outputtech = gr.Textbox(placeholder='', lines=4,label='Snapshot 2')
 
 
 
 
 
 
 
 
87
 
88
- btn.click(getstuff, inputs=[textboxopenapi,category_selector],outputs=[table1,outputtech])
89
 
90
 
91
  demo.launch(debug=True)
 
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","You are an award winning email writer. Write an email summarizing the news. Do not say I am language model and cannot do this","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 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","You are an award winning email writer. Write an email summarizing the news. Do not say I am language model and cannot do this","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 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","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"]
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","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"]
37
 
38
  documents = reader.load_data([rssurl])
39
  index = GPTSimpleVectorIndex(documents)
 
71
  with gr.Column():
72
  textboxopenapi = gr.Textbox(placeholder="Enter OpenAPI Key...", lines=1,label='OpenAPI Key')
73
  category_selector=gr.Dropdown(
74
+ listofcategories, label="Options", info="Select the snapshot you want..."
75
  )
76
  with gr.Column():
77
+ btn = gr.Button("Generate \nSnapshot")
78
 
79
  with gr.Row() as row:
80
  table1=gr.Dataframe(
81
  #headers=["Item", "Cost"],
82
+ #datatype=["str", "str","str"],
83
  label="Snapshot 1",
84
  )
85
  with gr.Row() as row:
86
+ table2=gr.Dataframe(
87
+ #headers=["Item", "Cost"],
88
+ #datatype=["str", "str","str"],
89
+ label="Snapshot 2",
90
+ )
91
+ with gr.Row() as row:
92
+ output1 = gr.Textbox(placeholder='', lines=4,label='Snapshot 3')
93
+ with gr.Row() as row:
94
+ output2 = gr.Textbox(placeholder='', lines=4,label='Snapshot 4')
95
 
96
+ btn.click(getstuff, inputs=[textboxopenapi,category_selector],outputs=[table1,table2,output1,output2])
97
 
98
 
99
  demo.launch(debug=True)