Spaces:
Sleeping
Sleeping
File size: 1,121 Bytes
53e0a4a dea6e8d 205c1d0 495c008 21403be 5a7327c efb2fcc 5a7327c 692e3e8 0c20ca5 5148e7a 495c008 56b163f 41a9792 60d90af 4f4d5be 312d8f6 4f4d5be |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import streamlit as st
import getpass
import os
from modelo import get_chain
st.set_page_config(layout="wide")
# Initialization
if 'historial' not in st.session_state:
st.session_state['historial'] = ['Hola soy tu asistente del dia de hoy, en que te puedo ayudar']
def get_data():
return st.session_state["historial"]
def add_data(value: str):
st.session_state["historial"] = value
os.environ["OPENAI_API_KEY"] = st.secrets['OPENAI_API_KEY'] # agregada en la config de hugginface
st.markdown("<h1 style='text-align: center; color: yellow;'>Chatbot SII</h1>", unsafe_allow_html=True)
st.header("Un ChatBot 🤖🦾 entrenado con preguntas frecuentes del sitio del servicios de impuestos interno de Chile.")
pregunta = st.text_area('Ingresa tu pregunta:', value="Que es un APA?")
tmp_button = st.button("CLICK")
chain = get_chain(st.secrets['OPENAI_API_KEY'])
if tmp_button: #Esperar al boton
out = chain.invoke(pregunta)
st.write(f"<p style='text-align: right; background-color: yellow;color: black;'>{out['query']}</p>", unsafe_allow_html=True)
#st.rerun() #Restart app
else:
st.stop() |