Spaces:
Runtime error
Runtime error
eduardo-meik
commited on
Commit
·
7823eb7
1
Parent(s):
98ec384
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,34 @@
|
|
1 |
-
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
-
|
6 |
pipe = pipeline('sentiment-analysis')
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
st.warning("Por favor, añade un texto para evaluar.")
|
16 |
|
|
|
|
1 |
+
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Define the sentiment analysis pipeline
|
|
|
5 |
pipe = pipeline('sentiment-analysis')
|
6 |
+
|
7 |
+
st.title("Plataforma de Diálogos Participativos")
|
8 |
+
|
9 |
+
# Split the page into two columns. The first column will occupy 1/4 of the page width and the second column 3/4.
|
10 |
+
col1, col2 = st.beta_columns([1,3])
|
11 |
+
|
12 |
+
with col1:
|
13 |
+
# This column will remain empty to act as a spacer
|
14 |
+
|
15 |
+
st.write("")
|
16 |
+
|
17 |
+
with col2:
|
18 |
+
# Text area for input
|
19 |
+
text = st.text_area("Añade el texto a evaluar")
|
20 |
+
|
21 |
+
# Buttons for different analysis (for this example, I'm assuming just sentiment analysis, you can add more)
|
22 |
+
run_analysis = st.button("Evaluar Sentimiento")
|
23 |
+
|
24 |
+
# Create a container for output to occupy the lower half of the layout
|
25 |
+
output_container = st.beta_container()
|
26 |
+
|
27 |
+
if run_analysis and text:
|
28 |
+
with output_container:
|
29 |
+
out = pipe(text)
|
30 |
+
st.json(out)
|
31 |
+
elif run_analysis and not text:
|
32 |
st.warning("Por favor, añade un texto para evaluar.")
|
33 |
|
34 |
+
|