Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,8 +11,9 @@ if 'historial' not in st.session_state:
|
|
11 |
def get_historial():
|
12 |
return st.session_state["historial"]
|
13 |
|
14 |
-
def add_historial(
|
15 |
-
st.session_state["historial"].append(
|
|
|
16 |
|
17 |
|
18 |
os.environ["OPENAI_API_KEY"] = st.secrets['OPENAI_API_KEY'] # agregada en la config de hugginface
|
@@ -25,9 +26,9 @@ tmp_button = st.button("CLICK")
|
|
25 |
chain = get_chain(st.secrets['OPENAI_API_KEY'])
|
26 |
if tmp_button: #Esperar al boton
|
27 |
out = chain.invoke(pregunta)
|
28 |
-
|
29 |
print(get_historial())
|
30 |
-
st.write(f"<p style='text-align: right;style='text-size: 30px; background-color: yellow;color: black;'>{out['
|
31 |
#st.rerun() #Restart app
|
32 |
else:
|
33 |
st.stop()
|
|
|
11 |
def get_historial():
|
12 |
return st.session_state["historial"]
|
13 |
|
14 |
+
def add_historial(respuesta):
|
15 |
+
st.session_state["historial"].append(respuesta["query"])
|
16 |
+
st.session_state["historial"].append(respuesta["result"])
|
17 |
|
18 |
|
19 |
os.environ["OPENAI_API_KEY"] = st.secrets['OPENAI_API_KEY'] # agregada en la config de hugginface
|
|
|
26 |
chain = get_chain(st.secrets['OPENAI_API_KEY'])
|
27 |
if tmp_button: #Esperar al boton
|
28 |
out = chain.invoke(pregunta)
|
29 |
+
add_historial(out)
|
30 |
print(get_historial())
|
31 |
+
st.write(f"<p style='text-align: right;style='text-size: 30px; background-color: yellow;color: black;'>{out['result']}</p>", unsafe_allow_html=True)
|
32 |
#st.rerun() #Restart app
|
33 |
else:
|
34 |
st.stop()
|