Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import getpass
|
| 3 |
import os
|
| 4 |
from modelo import get_chain
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
# Initialization
|
| 8 |
if 'historial' not in st.session_state:
|
| 9 |
-
st.session_state['historial'] = ['Hola soy tu asistente del dia de hoy, en que te puedo ayudar']
|
| 10 |
|
| 11 |
def get_historial():
|
| 12 |
return st.session_state["historial"]
|
|
@@ -15,13 +15,16 @@ def add_historial(respuesta):
|
|
| 15 |
st.session_state["historial"].append(respuesta["query"])
|
| 16 |
st.session_state["historial"].append(respuesta["result"])
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
st.
|
| 21 |
-
st.header("Un ChatBot 🤖🦾 entrenado con preguntas frecuentes del sitio del servicios de impuestos interno de Chile.")
|
| 22 |
|
| 23 |
pregunta = st.text_area('Ingresa tu pregunta:', value="Que es un APA?")
|
|
|
|
| 24 |
tmp_button = st.button("CLICK")
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
chain = get_chain(st.secrets['OPENAI_API_KEY'])
|
| 27 |
if tmp_button: #Esperar al boton
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
import os
|
| 3 |
from modelo import get_chain
|
| 4 |
+
|
| 5 |
+
os.environ["OPENAI_API_KEY"] = st.secrets['OPENAI_API_KEY'] # agregada en la config de hugginface
|
| 6 |
|
| 7 |
# Initialization
|
| 8 |
if 'historial' not in st.session_state:
|
| 9 |
+
st.session_state['historial'] = ['🤖 Hola soy tu asistente del dia de hoy, en que te puedo ayudar']
|
| 10 |
|
| 11 |
def get_historial():
|
| 12 |
return st.session_state["historial"]
|
|
|
|
| 15 |
st.session_state["historial"].append(respuesta["query"])
|
| 16 |
st.session_state["historial"].append(respuesta["result"])
|
| 17 |
|
| 18 |
+
#Menu Visual
|
| 19 |
+
st.markdown("<h1 style='text-align: center; color: yellow;'>Chatbot SII</h1>", unsafe_allow_html=True) #mandar un texto en html
|
| 20 |
+
st.header("🤖🦾ChatBot entrenado con preguntas frecuentes del sitio del servicios de impuestos interno de Chile.")
|
|
|
|
| 21 |
|
| 22 |
pregunta = st.text_area('Ingresa tu pregunta:', value="Que es un APA?")
|
| 23 |
+
st.divider()
|
| 24 |
tmp_button = st.button("CLICK")
|
| 25 |
+
st.write(get_historial()[0])
|
| 26 |
+
st.divider()
|
| 27 |
+
#Fin Menu
|
| 28 |
|
| 29 |
chain = get_chain(st.secrets['OPENAI_API_KEY'])
|
| 30 |
if tmp_button: #Esperar al boton
|