AdWeeb commited on
Commit
36f869a
1 Parent(s): fcac8f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -30,6 +30,7 @@ from utils import get_translation, welcome, get_large_audio_transcription
30
 
31
  from PIL import Image
32
 
 
33
 
34
  def main():
35
 
@@ -41,6 +42,9 @@ def main():
41
  max = st.sidebar.slider('Select max', 50, 500, step=10, value=150)
42
  min = st.sidebar.slider('Select min', 10, 450, step=10, value=50)
43
  gen_summ = False
 
 
 
44
  with st.spinner("Generating Summary.."):
45
 
46
  if button and video:
@@ -60,7 +64,11 @@ def main():
60
  summ=summarized[0]['summary_text']
61
  st.write(summ)
62
  gen_summ = True
63
-
 
 
 
 
64
  if 'summary' not in st.session_state:
65
  st.session_state.summary=True
66
  st.session_state.summarization = summ
@@ -81,8 +89,11 @@ def main():
81
  translation = get_translation(source='English', dest=s_type, text=summarized_text)
82
 
83
  st.sidebar.write(translation)
84
- else:
85
  st.error("The summary has not been generated yet. Please generate the summary first and then translate")
 
 
 
86
 
87
  if __name__ == '__main__':
88
 
 
30
 
31
  from PIL import Image
32
 
33
+ import stanfordnlp
34
 
35
  def main():
36
 
 
42
  max = st.sidebar.slider('Select max', 50, 500, step=10, value=150)
43
  min = st.sidebar.slider('Select min', 10, 450, step=10, value=50)
44
  gen_summ = False
45
+
46
+
47
+
48
  with st.spinner("Generating Summary.."):
49
 
50
  if button and video:
 
64
  summ=summarized[0]['summary_text']
65
  st.write(summ)
66
  gen_summ = True
67
+ stf_nlp = stanfordnlp.Pipeline(processors='tokenize,mwt,pos')
68
+ doc = stf_nlp(summ)
69
+ l=[w.text.capitalize() if w.upos in ["PROPN","NNS"] else w.text for sent in doc.sentences for w in sent.words]
70
+ text=" ".join(l)
71
+ summ=truecasing_by_sentence_segmentation(text)
72
  if 'summary' not in st.session_state:
73
  st.session_state.summary=True
74
  st.session_state.summarization = summ
 
89
  translation = get_translation(source='English', dest=s_type, text=summarized_text)
90
 
91
  st.sidebar.write(translation)
92
+ elif translate == 'Yes' and gen_summ == False:
93
  st.error("The summary has not been generated yet. Please generate the summary first and then translate")
94
+
95
+ else:
96
+ continue
97
 
98
  if __name__ == '__main__':
99