Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,23 +58,34 @@ import streamlit as st
|
|
| 58 |
#from .paraphraser import get_paraphrased_sentences, model, tokenizer
|
| 59 |
|
| 60 |
|
| 61 |
-
|
| 62 |
-
st.title('Paraphraser')
|
| 63 |
-
st.write('Please provide the text to be paraphrased')
|
| 64 |
-
col1, spacer, col2 = st.columns([3,1,3]) #st.beta_columns((2,1,1,1))
|
| 65 |
-
|
| 66 |
-
x = 0
|
| 67 |
-
output = ['Result ']
|
| 68 |
-
with col1:
|
| 69 |
-
user_input = st.text_area('Enter text','', height=200)
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
user_output = st.text_area(label="", value=output[x], height=150 )
|
|
|
|
| 58 |
#from .paraphraser import get_paraphrased_sentences, model, tokenizer
|
| 59 |
|
| 60 |
|
| 61 |
+
def app():
|
| 62 |
+
st.title('Paraphraser')
|
| 63 |
+
st.write('Please provide the text to be paraphrased')
|
| 64 |
+
col1, spacer, col2 = st.columns([3,1,3]) #st.beta_columns((2,1,1,1))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
x = 0
|
| 67 |
+
output = ['Result ']
|
| 68 |
+
with col1:
|
| 69 |
+
user_input = st.text_area('Enter text','', height=200)
|
| 70 |
+
|
| 71 |
+
paraphraseNo = st.slider('Number of Parapharases',1,10,2)
|
| 72 |
+
if st.button('Paraphrase'):
|
| 73 |
+
with st.spinner(text="This may take a moment..."):
|
| 74 |
+
output = get_paraphrased_sentences(model, tokenizer, user_input, num_beams=10, num_return_sequences=paraphraseNo)
|
| 75 |
+
|
| 76 |
+
#with spacer:
|
| 77 |
+
|
| 78 |
+
with col2:
|
| 79 |
+
for x, element in enumerate(output):
|
| 80 |
+
user_output = st.text_area(label="", value=output[x], height=150 )
|
| 81 |
+
|
| 82 |
|
| 83 |
+
hide_menu_style = """
|
| 84 |
+
<style>
|
| 85 |
+
#MainMenu {visibility: hidden;}
|
| 86 |
+
</style>
|
| 87 |
+
"""
|
| 88 |
+
st.markdown(hide_menu_style, unsafe_allow_html=True)
|
| 89 |
|
| 90 |
+
if __name__ == '__main__':
|
| 91 |
+
app()
|
|
|