Karthikeyan commited on
Commit
86ac1bb
·
1 Parent(s): e161238

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -21
app.py CHANGED
@@ -598,32 +598,38 @@ class KeyValueExtractor:
598
  def company_names(self,input_text):
599
  words = input_text.split("-")
600
  return words[1]
601
-
 
 
 
 
 
 
602
  def gradio_interface(self):
603
 
604
  with gr.Blocks(css="style.css",theme= 'karthikeyan-adople/hudsonhayes-gray') as app:
605
  with gr.Tabs():
606
- # with gr.TabItem("Google News"):
607
- # gr.HTML("""<center class="darkblue" style='background-color:rgb(0,1,36); text-align:center;padding:25px;'><center><h1 class ="center">
608
- # <img src="file=logo.png" height="110px" width="280px"></h1></center>
609
- # <br><h1 style="color:#fff">Company performance summarisation and sentiment analysis</h1></center>""")
610
- # with gr.Row(elem_id="col-container"):
611
- # with gr.Column(scale=1.0, min_width=150, ):
612
- # input_news = gr.Textbox(label="NEWS")
613
- # with gr.Row(elem_id="col-container"):
614
- # with gr.Column(scale=1, min_width=150):
615
- # result_summary_for_news = gr.Textbox(label="Summary", lines = 8)
616
- # with gr.Row(elem_id="col-container"):
617
- # with gr.Column(scale=0.50, min_width=150):
618
- # key_value_pair_result_for_news = gr.Textbox(label="Key Value Pair", lines = 15)
619
- # with gr.Column(scale=0.50, min_width=50):
620
- # sentiment_plot =gr.Plot(label="Sentiment", size=(300, 300))
621
- # with gr.Row(elem_id="col-container"):
622
- # with gr.Column(scale=1.0, min_width=150):
623
- # get_summary_for_news = gr.Button("Analyse")
624
 
625
- # get_summary_for_news.click(self.main_for_news, input_news, [result_summary_for_news,key_value_pair_result_for_news,sentiment_plot])
626
-
627
 
628
  with gr.TabItem("Finance Tool"):
629
  gr.HTML("""<center class="darkblue" style='background-color:rgb(0,1,36); text-align:center;padding:25px;'><center><h1 class ="center">
 
598
  def company_names(self,input_text):
599
  words = input_text.split("-")
600
  return words[1]
601
+ def clear(self,input_news,result_summary_for_news,key_value_pair_result_for_news,sentiment_plot):
602
+ input_news = None
603
+ result_summary_for_news = None
604
+ key_value_pair_result_for_news = None
605
+ sentiment_plot = None
606
+ return input_news,result_summary_for_news,key_value_pair_result_for_news,sentiment_plot
607
+
608
  def gradio_interface(self):
609
 
610
  with gr.Blocks(css="style.css",theme= 'karthikeyan-adople/hudsonhayes-gray') as app:
611
  with gr.Tabs():
612
+ with gr.TabItem("Google News"):
613
+ gr.HTML("""<center class="darkblue" style='background-color:rgb(0,1,36); text-align:center;padding:25px;'><center><h1 class ="center">
614
+ <img src="file=logo.png" height="110px" width="280px"></h1></center>
615
+ <br><h1 style="color:#fff">Company performance summarisation and sentiment analysis</h1></center>""")
616
+ with gr.Row(elem_id="col-container"):
617
+ with gr.Column(scale=0.80, min_width=150, ):
618
+ input_news = gr.Textbox(label="NEWS")
619
+ with gr.Column(scale=0.20, min_width=150):
620
+ get_summary_for_news = gr.Button("Analyse")
621
+ clear_btn = gr.ClearButton()
622
+ with gr.Row(elem_id="col-container"):
623
+ with gr.Column(scale=1, min_width=150):
624
+ result_summary_for_news = gr.Textbox(label="Summary", lines = 8)
625
+ with gr.Row(elem_id="col-container"):
626
+ with gr.Column(scale=0.50, min_width=150):
627
+ key_value_pair_result_for_news = gr.Textbox(label="Key Value Pair", lines = 15)
628
+ with gr.Column(scale=0.50, min_width=50):
629
+ sentiment_plot =gr.Plot(label="Sentiment", size=(300, 300))
630
 
631
+ get_summary_for_news.click(self.main_for_news, input_news, [result_summary_for_news,key_value_pair_result_for_news,sentiment_plot])
632
+ 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] )
633
 
634
  with gr.TabItem("Finance Tool"):
635
  gr.HTML("""<center class="darkblue" style='background-color:rgb(0,1,36); text-align:center;padding:25px;'><center><h1 class ="center">