knkarthick commited on
Commit
3cf9c24
·
1 Parent(s): a9cdc56

Add application file

Browse files
Files changed (2) hide show
  1. .ipynb_checkpoints/app-checkpoint.py +7 -7
  2. app.py +7 -7
.ipynb_checkpoints/app-checkpoint.py CHANGED
@@ -49,14 +49,14 @@ def summarize_text2(text):
49
  return stext
50
 
51
  ##Fiscal Tone Analysis
52
- fin_model= pipeline("sentiment-analysis", model='knkarthick/Sentiment-Analysis', tokenizer='knkarthick/Sentiment-Analysis')
53
  def text_to_sentiment(text):
54
- sentiment = fin_model(text)[0]["label"]
55
  return sentiment
56
 
57
  ##Fiscal Sentiment by Sentence
58
- def fin_ext(text):
59
- results = fin_model(split_in_sentences(text))
60
  return make_spans(text,results)
61
 
62
  demo = gr.Blocks()
@@ -75,9 +75,9 @@ with demo:
75
  with gr.Row():
76
  b2 = gr.Button("Dialogue Sentiment Analysis")
77
  fin_spans = gr.HighlightedText()
78
- b2.click(fin_ext, inputs=text, outputs=fin_spans)
79
  with gr.Row():
80
- b3 = gr.Button("Summarize Text [Model-I/ Model-II/ Model-III]")
81
  with gr.Column():
82
  with gr.Row():
83
  stext = gr.Textbox()
@@ -91,7 +91,7 @@ with demo:
91
  stext2 = gr.Textbox()
92
  b3.click(summarize_text2, inputs=text, outputs=stext2)
93
  with gr.Row():
94
- b4 = gr.Button("Sentiment of Summary-I/ Summary-II/ Summary-III")
95
  with gr.Column():
96
  with gr.Row():
97
  label = gr.Label()
 
49
  return stext
50
 
51
  ##Fiscal Tone Analysis
52
+ sen_model= pipeline("sentiment-analysis", model='knkarthick/Sentiment-Analysis', tokenizer='knkarthick/Sentiment-Analysis')
53
  def text_to_sentiment(text):
54
+ sentiment = sen_model(text)[0]["label"]
55
  return sentiment
56
 
57
  ##Fiscal Sentiment by Sentence
58
+ def sen_ext(text):
59
+ results = sen_model(split_in_sentences(text))
60
  return make_spans(text,results)
61
 
62
  demo = gr.Blocks()
 
75
  with gr.Row():
76
  b2 = gr.Button("Dialogue Sentiment Analysis")
77
  fin_spans = gr.HighlightedText()
78
+ b2.click(sen_ext, inputs=text, outputs=fin_spans)
79
  with gr.Row():
80
+ b3 = gr.Button("Summarization [Model-I/II/III]")
81
  with gr.Column():
82
  with gr.Row():
83
  stext = gr.Textbox()
 
91
  stext2 = gr.Textbox()
92
  b3.click(summarize_text2, inputs=text, outputs=stext2)
93
  with gr.Row():
94
+ b4 = gr.Button("Sentiment of Summary-I/II/III")
95
  with gr.Column():
96
  with gr.Row():
97
  label = gr.Label()
app.py CHANGED
@@ -49,14 +49,14 @@ def summarize_text2(text):
49
  return stext
50
 
51
  ##Fiscal Tone Analysis
52
- fin_model= pipeline("sentiment-analysis", model='knkarthick/Sentiment-Analysis', tokenizer='knkarthick/Sentiment-Analysis')
53
  def text_to_sentiment(text):
54
- sentiment = fin_model(text)[0]["label"]
55
  return sentiment
56
 
57
  ##Fiscal Sentiment by Sentence
58
- def fin_ext(text):
59
- results = fin_model(split_in_sentences(text))
60
  return make_spans(text,results)
61
 
62
  demo = gr.Blocks()
@@ -75,9 +75,9 @@ with demo:
75
  with gr.Row():
76
  b2 = gr.Button("Dialogue Sentiment Analysis")
77
  fin_spans = gr.HighlightedText()
78
- b2.click(fin_ext, inputs=text, outputs=fin_spans)
79
  with gr.Row():
80
- b3 = gr.Button("Summarize Text [Model-I/ Model-II/ Model-III]")
81
  with gr.Column():
82
  with gr.Row():
83
  stext = gr.Textbox()
@@ -91,7 +91,7 @@ with demo:
91
  stext2 = gr.Textbox()
92
  b3.click(summarize_text2, inputs=text, outputs=stext2)
93
  with gr.Row():
94
- b4 = gr.Button("Sentiment of Summary-I/ Summary-II/ Summary-III")
95
  with gr.Column():
96
  with gr.Row():
97
  label = gr.Label()
 
49
  return stext
50
 
51
  ##Fiscal Tone Analysis
52
+ sen_model= pipeline("sentiment-analysis", model='knkarthick/Sentiment-Analysis', tokenizer='knkarthick/Sentiment-Analysis')
53
  def text_to_sentiment(text):
54
+ sentiment = sen_model(text)[0]["label"]
55
  return sentiment
56
 
57
  ##Fiscal Sentiment by Sentence
58
+ def sen_ext(text):
59
+ results = sen_model(split_in_sentences(text))
60
  return make_spans(text,results)
61
 
62
  demo = gr.Blocks()
 
75
  with gr.Row():
76
  b2 = gr.Button("Dialogue Sentiment Analysis")
77
  fin_spans = gr.HighlightedText()
78
+ b2.click(sen_ext, inputs=text, outputs=fin_spans)
79
  with gr.Row():
80
+ b3 = gr.Button("Summarization [Model-I/II/III]")
81
  with gr.Column():
82
  with gr.Row():
83
  stext = gr.Textbox()
 
91
  stext2 = gr.Textbox()
92
  b3.click(summarize_text2, inputs=text, outputs=stext2)
93
  with gr.Row():
94
+ b4 = gr.Button("Sentiment of Summary-I/II/III")
95
  with gr.Column():
96
  with gr.Row():
97
  label = gr.Label()