MelisaRS commited on
Commit
998f4df
verified
1 Parent(s): 0c37ddb

add changes with interface

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -1,13 +1,32 @@
 
1
  # Use a pipeline as a high-level helper
2
  from transformers import pipeline
3
 
 
4
  pipe = pipeline("text-classification", model="ProsusAI/finbert")
5
 
 
 
 
6
  # Texto de ejemplo
7
- texto = "The company's stock price increased by 5% after the quarterly earnings report."
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  # Usamos el pipeline para clasificar el texto
10
  resultado = pipe(texto)
11
 
12
  # Mostramos el resultado
13
- print(resultado)
 
 
1
+ import streamlit as st
2
  # Use a pipeline as a high-level helper
3
  from transformers import pipeline
4
 
5
+ # Cargar el modelo FinBERT
6
  pipe = pipeline("text-classification", model="ProsusAI/finbert")
7
 
8
+ # T铆tulo en la p谩gina de Streamlit
9
+ st.title("Clasificador de Textos Financieros con FinBERT")
10
+
11
  # Texto de ejemplo
12
+ texto = st.text_area("The company's stock price increased by 5% after the quarterly earnings report.")
13
 
14
+ # Bot贸n para ejecutar la clasificaci贸n
15
+ if st.button("Clasificar"):
16
+ if texto:
17
+ # Usar el pipeline para clasificar el texto
18
+ resultado = pipe(texto)
19
+
20
+ # Mostrar el resultado en la pantalla usando Streamlit
21
+ st.write("Resultado de la clasificaci贸n:")
22
+ st.write(resultado)
23
+ else:
24
+ st.write("Por favor, introduce un texto para clasificar.")
25
+
26
+ '''
27
  # Usamos el pipeline para clasificar el texto
28
  resultado = pipe(texto)
29
 
30
  # Mostramos el resultado
31
+ print(resultado)
32
+ '''