Update app.py
Browse files
app.py
CHANGED
@@ -152,18 +152,17 @@ elif selected == "Chatbot":
|
|
152 |
if loaded_chat:
|
153 |
st.session_state.chat_session = loaded_chat
|
154 |
else:
|
|
|
155 |
st.session_state.chat_session = model.start_chat(history=[])
|
156 |
-
if st.session_state.system_prompt:
|
157 |
-
st.session_state.chat_session.send_message(st.session_state.system_prompt)
|
158 |
|
159 |
st.title("Gnosticdev Chatbot")
|
160 |
-
|
161 |
-
|
162 |
-
st.info(st.session_state.system_prompt)
|
163 |
for message in st.session_state.chat_session.history:
|
164 |
with st.chat_message(translate_role_to_streamlit(message.role)):
|
165 |
st.markdown(message.parts[0].text)
|
166 |
|
|
|
167 |
user_prompt = st.chat_input("Preg煤ntame algo...")
|
168 |
if user_prompt:
|
169 |
processed_user_prompt = process_urls_in_prompt(user_prompt)
|
@@ -173,6 +172,7 @@ elif selected == "Chatbot":
|
|
173 |
st.markdown(gemini_response.text)
|
174 |
save_chat_history(st.session_state.chat_session.history)
|
175 |
|
|
|
176 |
elif selected == "Image Captioning":
|
177 |
st.title("Image Caption Generation馃摳")
|
178 |
upload_image = st.file_uploader("Sube una imagen...", type=["jpg", "jpeg", "png"])
|
|
|
152 |
if loaded_chat:
|
153 |
st.session_state.chat_session = loaded_chat
|
154 |
else:
|
155 |
+
# Crea una nueva sesi贸n de chat sin enviar el system_prompt como mensaje inicial
|
156 |
st.session_state.chat_session = model.start_chat(history=[])
|
|
|
|
|
157 |
|
158 |
st.title("Gnosticdev Chatbot")
|
159 |
+
|
160 |
+
# Muestra solo el historial del chat, si existe
|
|
|
161 |
for message in st.session_state.chat_session.history:
|
162 |
with st.chat_message(translate_role_to_streamlit(message.role)):
|
163 |
st.markdown(message.parts[0].text)
|
164 |
|
165 |
+
# Entrada del usuario
|
166 |
user_prompt = st.chat_input("Preg煤ntame algo...")
|
167 |
if user_prompt:
|
168 |
processed_user_prompt = process_urls_in_prompt(user_prompt)
|
|
|
172 |
st.markdown(gemini_response.text)
|
173 |
save_chat_history(st.session_state.chat_session.history)
|
174 |
|
175 |
+
|
176 |
elif selected == "Image Captioning":
|
177 |
st.title("Image Caption Generation馃摳")
|
178 |
upload_image = st.file_uploader("Sube una imagen...", type=["jpg", "jpeg", "png"])
|