Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,41 +78,20 @@ elif option == 'Text summarization':
|
|
| 78 |
|
| 79 |
elif option == 'Text generation':
|
| 80 |
st.markdown("<h2 style='text-align: center; color:grey;'>Generate text</h2>", unsafe_allow_html=True)
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
generated_text = generator(text, max_length=50)
|
| 89 |
-
st.write(generated_text[0]["generated_text"])
|
| 90 |
-
|
| 91 |
-
elif source == "I want to upload a file":
|
| 92 |
-
uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt"])
|
| 93 |
-
button = st.button('Generate text')
|
| 94 |
-
if button:
|
| 95 |
-
generator = generation_model()
|
| 96 |
-
with st.spinner(text="Generating text..."):
|
| 97 |
-
generated_text = generator(text, max_length=50)
|
| 98 |
-
st.write(generated_text[0]["generated_text"])
|
| 99 |
|
| 100 |
elif option == 'Sentiment analysis':
|
| 101 |
st.markdown("<h2 style='text-align: center; color:grey;'>Classify review</h2>", unsafe_allow_html=True)
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
sentiment = sentiment_analysis(text)
|
| 110 |
-
st.write(sentiment[0]["label"])
|
| 111 |
-
elif source == "I want to upload a file":
|
| 112 |
-
uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt"])
|
| 113 |
-
button = st.button('Get sentiment analysis')
|
| 114 |
-
if button:
|
| 115 |
-
sentiment_analysis = sentiment_model()
|
| 116 |
-
with st.spinner(text="Getting sentiment analysis..."):
|
| 117 |
-
sentiment = sentiment_analysis(text)
|
| 118 |
-
st.write(sentiment[0]["label"])
|
|
|
|
| 78 |
|
| 79 |
elif option == 'Text generation':
|
| 80 |
st.markdown("<h2 style='text-align: center; color:grey;'>Generate text</h2>", unsafe_allow_html=True)
|
| 81 |
+
text = st.text_input(label='Enter one line of text and let the NLP model generate the rest for you')
|
| 82 |
+
button = st.button('Generate text')
|
| 83 |
+
if button:
|
| 84 |
+
generator = generation_model()
|
| 85 |
+
with st.spinner(text="Generating text..."):
|
| 86 |
+
generated_text = generator(text, max_length=50)
|
| 87 |
+
st.write(generated_text[0]["generated_text"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
elif option == 'Sentiment analysis':
|
| 90 |
st.markdown("<h2 style='text-align: center; color:grey;'>Classify review</h2>", unsafe_allow_html=True)
|
| 91 |
+
text = st.text_input(label='Enter a sentence to get its sentiment analysis')
|
| 92 |
+
button = st.button('Get sentiment analysis')
|
| 93 |
+
if button:
|
| 94 |
+
sentiment_analysis = sentiment_model()
|
| 95 |
+
with st.spinner(text="Getting sentiment analysis..."):
|
| 96 |
+
sentiment = sentiment_analysis(text)
|
| 97 |
+
st.write(sentiment[0]["label"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|