Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import pipeline | |
# Define the sentiment analysis pipeline | |
pipe = pipeline('sentiment-analysis') | |
st.title("Plataforma de Diálogos Participativos") | |
# Split the page into two columns. The first column will occupy 1/4 of the page width and the second column 3/4. | |
col1, col2 = st.beta_columns([1,3]) | |
with col1: | |
# Text area for input | |
text = st.text_area("Añade el texto a evaluar") | |
# Buttons for different analysis (for this example, I'm assuming just sentiment analysis, you can add more) | |
run_analysis = st.button("Evaluar Sentimiento") | |
with col2: | |
st.write("Resultados") | |
# Create a container for output to occupy the lower half of the layout | |
output_container = st.beta_container() | |
if run_analysis and text: | |
with output_container: | |
out = pipe(text) | |
st.json(out) | |
elif run_analysis and not text: | |
st.warning("Por favor, añade un texto para evaluar.") | |