Spaces:
Runtime error
Runtime error
Cynthiaaaaaaaa
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -3,8 +3,8 @@ from transformers import pipeline
|
|
3 |
|
4 |
# Summarization
|
5 |
def summarization(text):
|
6 |
-
|
7 |
-
summary =
|
8 |
return summary
|
9 |
|
10 |
# Sentiment Classification
|
@@ -14,18 +14,14 @@ def sentiment_classification(summary):
|
|
14 |
return result
|
15 |
|
16 |
def main():
|
17 |
-
st.set_page_config(page_title="Your
|
18 |
st.header("Tell me your comments!")
|
19 |
-
|
20 |
-
|
21 |
-
if uploaded_file is not None:
|
22 |
-
with open(uploaded_file.name, "wb") as file:
|
23 |
-
file.write(uploaded_file.getbuffer())
|
24 |
-
st.image(uploaded_file, caption="Uploaded Image", use_column_width=True)
|
25 |
|
|
|
26 |
# Stage 1: Summarization
|
27 |
-
st.text('Processing
|
28 |
-
summary = summarization(
|
29 |
st.write(summary)
|
30 |
|
31 |
# Stage 2: Sentiment Classification
|
|
|
3 |
|
4 |
# Summarization
|
5 |
def summarization(text):
|
6 |
+
text_model = pipeline("text-generation", model="ainize/bart-base-cnn")
|
7 |
+
summary = text_model(text, max_length=100, do_sample=False)[0]["generated_text"]
|
8 |
return summary
|
9 |
|
10 |
# Sentiment Classification
|
|
|
14 |
return result
|
15 |
|
16 |
def main():
|
17 |
+
st.set_page_config(page_title="Your Text Analysis", page_icon="🦜")
|
18 |
st.header("Tell me your comments!")
|
19 |
+
text_input = st.text_input("Enter your text here:")
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
if text_input:
|
22 |
# Stage 1: Summarization
|
23 |
+
st.text('Processing text...')
|
24 |
+
summary = summarization(text_input)
|
25 |
st.write(summary)
|
26 |
|
27 |
# Stage 2: Sentiment Classification
|