Karthikeyan commited on
Commit
230a976
·
1 Parent(s): 4d247ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -54
app.py CHANGED
@@ -617,65 +617,44 @@ class KeyValueExtractor:
617
  gr.HTML("""<center class="darkblue" style='background-color:rgb(0,1,36); text-align:center;padding:25px;'><center><h1 class ="center">
618
  <img src="file=logo.png" height="110px" width="280px"></h1></center>
619
  <br><h1 style="color:#fff">Company performance summarisation and sentiment analysis</h1></center>""")
 
 
 
 
 
 
 
 
 
 
 
 
 
620
  with gr.Tabs():
621
- with gr.TabItem("Google News Analysis"):
622
  with gr.Row(elem_id="col-container"):
623
- with gr.Column(scale=0.80, min_width=150, ):
624
- input_news = gr.Textbox(label="NEWS")
625
- with gr.Column(scale=0.20, min_width=150):
626
- get_summary_for_news = gr.Button("Analyse")
627
- clear_btn = gr.ClearButton()
628
  with gr.Row(elem_id="col-container"):
629
  with gr.Column(scale=1, min_width=150):
630
- result_summary_for_news = gr.Textbox(label="Summary", lines = 8)
 
 
 
 
 
 
631
  with gr.Row(elem_id="col-container"):
632
- with gr.Column(scale=0.50, min_width=150):
633
- key_value_pair_result_for_news = gr.Textbox(label="Key Value Pair", lines = 15)
634
- with gr.Column(scale=0.50, min_width=50):
635
- sentiment_plot =gr.Plot(label="Sentiment", size=(300, 300))
636
-
637
- get_summary_for_news.click(self.main_for_news, input_news, [result_summary_for_news,key_value_pair_result_for_news,sentiment_plot])
638
- clear_btn.click(self.clear,[input_news,result_summary_for_news,key_value_pair_result_for_news,sentiment_plot],[input_news,result_summary_for_news,key_value_pair_result_for_news,sentiment_plot] )
639
-
640
- with gr.TabItem("Finance Analysis"):
641
- with gr.Row(elem_id="col-container"):
642
- with gr.Column(scale=1.0, min_width=150, ):
643
- input_news = gr.Textbox(label="Company Name")
644
- with gr.Accordion("Sample Inputs", open = True):
645
- with gr.Row(elem_id="col-container"):
646
- with gr.Column(scale=1.0, min_width=150 ):
647
- gr.Examples(
648
- [["Apple Inc. - AAPL"], ["Microsoft Corporation - MSFT"],["Amazon.com Inc. - AMZN"],["Tesla Inc. - TSLA"],["Alphabet Inc. - GOOG"],[" NVIDIA Corporation - NVDA"]],
649
- [input_news],
650
- input_news,
651
- fn=self.company_names,
652
- cache_examples=True,
653
- )
654
- with gr.Tabs():
655
- with gr.TabItem("Last Day Analysis"):
656
- with gr.Row(elem_id="col-container"):
657
- with gr.Column(scale=1.0, min_width=150):
658
- analyse_summary_for_finance = gr.Button("Analyse")
659
- with gr.Row(elem_id="col-container"):
660
- with gr.Column(scale=1, min_width=150):
661
- result_summary = gr.Textbox(label="Summary", lines = 10)
662
- with gr.Row(elem_id="col-container"):
663
- with gr.Column(scale=0.50, min_width=0):
664
- key_value_pair_result = gr.Textbox(label="Key Value Pair", lines = 10)
665
- with gr.Column(scale=0.50, min_width=0):
666
- plot_for_one_day =gr.Plot(label="Sentiment", size=(500, 500))
667
- with gr.TabItem("One Year Analyis"):
668
- with gr.Row(elem_id="col-container"):
669
- with gr.Column(scale=1.0, min_width=150):
670
- one_year = gr.Button("Analyse")
671
- with gr.Row(elem_id="col-container"):
672
- with gr.Column(scale=1.0, min_width=150, ):
673
- one_year_summary = gr.Textbox(label="Summary Of One Year Perfomance",lines = 20)
674
- with gr.Column(scale=1.0, min_width=0):
675
- plot_for_year =gr.Plot(label="Sentiment", size=(500, 500))
676
-
677
- analyse_summary_for_finance.click(self.main_for_finance_tool, input_news, [result_summary,key_value_pair_result,plot_for_one_day])
678
- one_year.click(self.one_year_summary_for_finance,input_news,[one_year_summary,plot_for_year])
679
 
680
  app.launch(debug = True)
681
 
 
617
  gr.HTML("""<center class="darkblue" style='background-color:rgb(0,1,36); text-align:center;padding:25px;'><center><h1 class ="center">
618
  <img src="file=logo.png" height="110px" width="280px"></h1></center>
619
  <br><h1 style="color:#fff">Company performance summarisation and sentiment analysis</h1></center>""")
620
+ with gr.Row(elem_id="col-container"):
621
+ with gr.Column(scale=1.0, min_width=150, ):
622
+ input_news = gr.Textbox(label="Company Name")
623
+ with gr.Accordion("Sample Inputs", open = True):
624
+ with gr.Row(elem_id="col-container"):
625
+ with gr.Column(scale=1.0, min_width=150 ):
626
+ gr.Examples(
627
+ [["Apple Inc. - AAPL"], ["Microsoft Corporation - MSFT"],["Amazon.com Inc. - AMZN"],["Tesla Inc. - TSLA"],["Alphabet Inc. - GOOG"],[" NVIDIA Corporation - NVDA"]],
628
+ [input_news],
629
+ input_news,
630
+ fn=self.company_names,
631
+ cache_examples=True,
632
+ )
633
  with gr.Tabs():
634
+ with gr.TabItem("Last Day Analysis"):
635
  with gr.Row(elem_id="col-container"):
636
+ with gr.Column(scale=1.0, min_width=150):
637
+ analyse_summary_for_finance = gr.Button("Analyse")
 
 
 
638
  with gr.Row(elem_id="col-container"):
639
  with gr.Column(scale=1, min_width=150):
640
+ result_summary = gr.Textbox(label="Summary", lines = 10)
641
+ with gr.Row(elem_id="col-container"):
642
+ with gr.Column(scale=0.50, min_width=0):
643
+ key_value_pair_result = gr.Textbox(label="Key Value Pair", lines = 10)
644
+ with gr.Column(scale=0.50, min_width=0):
645
+ plot_for_one_day =gr.Plot(label="Sentiment", size=(500, 500))
646
+ with gr.TabItem("One Year Analyis"):
647
  with gr.Row(elem_id="col-container"):
648
+ with gr.Column(scale=1.0, min_width=150):
649
+ one_year = gr.Button("Analyse")
650
+ with gr.Row(elem_id="col-container"):
651
+ with gr.Column(scale=1.0, min_width=150, ):
652
+ one_year_summary = gr.Textbox(label="Summary Of One Year Perfomance",lines = 20)
653
+ with gr.Column(scale=1.0, min_width=0):
654
+ plot_for_year =gr.Plot(label="Sentiment", size=(500, 500))
655
+
656
+ analyse_summary_for_finance.click(self.main_for_finance_tool, input_news, [result_summary,key_value_pair_result,plot_for_one_day])
657
+ one_year.click(self.one_year_summary_for_finance,input_news,[one_year_summary,plot_for_year])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
658
 
659
  app.launch(debug = True)
660