Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ def main():
|
|
40 |
|
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 |
-
|
44 |
with st.spinner("Generating Summary.."):
|
45 |
|
46 |
if button and video:
|
@@ -59,15 +59,17 @@ def main():
|
|
59 |
summarized = summarizer(whole_text, min_length=75, max_length=400)
|
60 |
summ=summarized[0]['summary_text']
|
61 |
st.write(summ)
|
62 |
-
|
|
|
63 |
if 'summary' not in st.session_state:
|
64 |
st.session_state.summary=True
|
65 |
st.session_state.summarization = summ
|
|
|
66 |
|
67 |
|
68 |
translate = st.sidebar.radio('Do you want to translate the text to any different language?', ('No', 'Yes'))
|
69 |
|
70 |
-
if translate == 'Yes':
|
71 |
lang_list = ['Hindi', 'Marathi', 'Malayalam', 'Kannada', 'Telugu', 'Tamil', 'Oriya', 'Bengali', 'Gujarati', 'Urdu']
|
72 |
|
73 |
s_type = st.sidebar.selectbox('Select the Language in which you want to Translate:',lang_list)
|
@@ -79,7 +81,8 @@ def main():
|
|
79 |
translation = get_translation(source='English', dest=s_type, text=summarized_text)
|
80 |
|
81 |
st.sidebar.write(translation)
|
82 |
-
|
|
|
83 |
|
84 |
if __name__ == '__main__':
|
85 |
|
|
|
40 |
|
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:
|
|
|
59 |
summarized = summarizer(whole_text, min_length=75, max_length=400)
|
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
|
67 |
+
|
68 |
|
69 |
|
70 |
translate = st.sidebar.radio('Do you want to translate the text to any different language?', ('No', 'Yes'))
|
71 |
|
72 |
+
if translate == 'Yes' and gen_summ == True:
|
73 |
lang_list = ['Hindi', 'Marathi', 'Malayalam', 'Kannada', 'Telugu', 'Tamil', 'Oriya', 'Bengali', 'Gujarati', 'Urdu']
|
74 |
|
75 |
s_type = st.sidebar.selectbox('Select the Language in which you want to Translate:',lang_list)
|
|
|
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 |
|