Sasidhar commited on
Commit
ce7b644
·
1 Parent(s): 194ba08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -32,10 +32,18 @@ def get_sentiment(text):
32
  def get_summarizer():
33
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
34
  return summarizer
35
-
 
 
 
 
 
 
36
  sentiment_model = get_sentiment_model()
37
  summarizer = get_summarizer()
38
- text_generator = load_text_gen_model()
 
 
39
 
40
  action = st.sidebar.selectbox("Pick an Action", ["Analyse a Review","Generate an Article","Create an Image"])
41
 
@@ -50,6 +58,13 @@ if action == "Analyse a Review":
50
  if st.button("Summarize the review"):
51
  summary = summarizer(review, max_length=130, min_length=30, do_sample=False)
52
  st.write(summary)
 
 
 
 
 
 
53
 
 
54
 
55
 
 
32
  def get_summarizer():
33
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
34
  return summarizer
35
+
36
+ def get_qa_model():
37
+ model_name = "deepset/roberta-base-squad2"
38
+
39
+ qa_pipeline = = pipeline('question-answering', model=model_name, tokenizer=model_name)
40
+ return qa_pipeline
41
+
42
  sentiment_model = get_sentiment_model()
43
  summarizer = get_summarizer()
44
+ answer_geerator = get_qa_model()
45
+
46
+ #text_generator = load_text_gen_model()
47
 
48
  action = st.sidebar.selectbox("Pick an Action", ["Analyse a Review","Generate an Article","Create an Image"])
49
 
 
58
  if st.button("Summarize the review"):
59
  summary = summarizer(review, max_length=130, min_length=30, do_sample=False)
60
  st.write(summary)
61
+
62
+ if st.button("Find the key topic"):
63
+ QA_input = {'question': 'what is the review about?',
64
+ 'context': review}
65
+ answer = answer_geerator (QA_input)
66
+ st.write(answer)
67
 
68
+
69
 
70