Spaces:
Runtime error
Runtime error
Matias Stager commited on
Commit ·
b7ce9ea
1
Parent(s): 0c087fd
Mensaje de Pausa
Browse files
app.py
CHANGED
|
@@ -10,6 +10,7 @@ openai.api_key = os.getenv('openai_key')
|
|
| 10 |
|
| 11 |
st.title("ChileanGPT 2.0: An Experimental Chilean AI Language Model")
|
| 12 |
st.subheader("Leveraging the Power of GPT-Enhanced for Natural Chilean Spanish Dialogues")
|
|
|
|
| 13 |
hide_footer_style = """
|
| 14 |
<style>
|
| 15 |
.main footer {visibility: hidden;}
|
|
@@ -17,55 +18,4 @@ hide_footer_style = """
|
|
| 17 |
"""
|
| 18 |
st.markdown(hide_footer_style, unsafe_allow_html=True)
|
| 19 |
|
| 20 |
-
|
| 21 |
-
st.session_state['generated'] = []
|
| 22 |
-
if 'past' not in st.session_state:
|
| 23 |
-
st.session_state['past'] = []
|
| 24 |
-
if 'interaction_count' not in st.session_state:
|
| 25 |
-
st.session_state['interaction_count'] = 0
|
| 26 |
-
if 'messages' not in st.session_state:
|
| 27 |
-
st.session_state['messages'] = get_initial_message()
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
def generate_response(_input_user):
|
| 31 |
-
if _input_user:
|
| 32 |
-
with st.spinner("pensando..."):
|
| 33 |
-
st.session_state['interaction_count'] += 1
|
| 34 |
-
messages = st.session_state['messages']
|
| 35 |
-
messages = update_chat(messages, "user", _input_user, st.session_state['interaction_count'])
|
| 36 |
-
# st.write("Before making the API call")
|
| 37 |
-
# st.write(messages)
|
| 38 |
-
response = get_chatgpt_response(messages,"gpt-4")
|
| 39 |
-
messages = update_chat(messages, "assistant", response, st.session_state['interaction_count'])
|
| 40 |
-
return response
|
| 41 |
-
|
| 42 |
-
# container for chat history
|
| 43 |
-
response_container = st.container()
|
| 44 |
-
# container for text box
|
| 45 |
-
container = st.container()
|
| 46 |
-
|
| 47 |
-
with container:
|
| 48 |
-
with st.form("chat_input", clear_on_submit=True):
|
| 49 |
-
a, b = st.columns([4, 1])
|
| 50 |
-
user_input = a.text_input(
|
| 51 |
-
label="Mensaje:",
|
| 52 |
-
placeholder="Escribe algo...",
|
| 53 |
-
label_visibility="collapsed",
|
| 54 |
-
)
|
| 55 |
-
submit_button = b.form_submit_button("Enviar", use_container_width=True)
|
| 56 |
-
if user_input or submit_button:
|
| 57 |
-
output = generate_response(user_input)
|
| 58 |
-
st.session_state.generated.append(output)
|
| 59 |
-
st.session_state.past.append(user_input)
|
| 60 |
-
|
| 61 |
-
if st.session_state['generated']:
|
| 62 |
-
with response_container:
|
| 63 |
-
for i in range(len(st.session_state['generated'])):
|
| 64 |
-
message(st.session_state['past'][i], is_user=True, key=str(i) + '_user')
|
| 65 |
-
message(st.session_state["generated"][i], key=str(i))
|
| 66 |
-
|
| 67 |
-
# with st.expander("session_state"):
|
| 68 |
-
# st.write(st.session_state)
|
| 69 |
-
|
| 70 |
-
# with st.expander("Mensajes"):
|
| 71 |
-
# st.write(messages)
|
|
|
|
| 10 |
|
| 11 |
st.title("ChileanGPT 2.0: An Experimental Chilean AI Language Model")
|
| 12 |
st.subheader("Leveraging the Power of GPT-Enhanced for Natural Chilean Spanish Dialogues")
|
| 13 |
+
|
| 14 |
hide_footer_style = """
|
| 15 |
<style>
|
| 16 |
.main footer {visibility: hidden;}
|
|
|
|
| 18 |
"""
|
| 19 |
st.markdown(hide_footer_style, unsafe_allow_html=True)
|
| 20 |
|
| 21 |
+
st.write("Gracias a todos los que participaron probando ChileanGPT. Lamentablemente, he tenido que poner en pausa este proyecto debido a ciertos comportamientos imprevistos de la Inteligencia Artificial y su extraño uso del lenguaje Chileno. Espero volver prontamente con una nueva versión.\n\nMatías")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|