Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,10 +72,6 @@ model = genai.GenerativeModel('gemini-1.5-flash',
|
|
| 72 |
st.set_page_config(page_title="Mariam - Assistant IA", page_icon="馃")
|
| 73 |
st.title("Mariam AI - Chat Intelligent")
|
| 74 |
|
| 75 |
-
# Initialiser l'historique de chat
|
| 76 |
-
if "chat" not in st.session_state:
|
| 77 |
-
st.session_state.chat = model.start_chat(history=[])
|
| 78 |
-
|
| 79 |
# CSS personnalis茅 pour le conteneur d'upload
|
| 80 |
st.markdown("""
|
| 81 |
<style>
|
|
@@ -89,13 +85,24 @@ st.markdown("""
|
|
| 89 |
gap: 10px;
|
| 90 |
margin-bottom: 10px;
|
| 91 |
}
|
| 92 |
-
.
|
| 93 |
-
display:
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
}
|
| 96 |
</style>
|
| 97 |
""", unsafe_allow_html=True)
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
# Afficher l'historique des messages
|
| 100 |
for message in st.session_state.chat.history:
|
| 101 |
with st.chat_message(role_to_streamlit(message.role)):
|
|
@@ -109,22 +116,26 @@ for message in st.session_state.chat.history:
|
|
| 109 |
input_container = st.container()
|
| 110 |
|
| 111 |
with input_container:
|
| 112 |
-
col1, col2
|
| 113 |
-
|
| 114 |
-
with col3:
|
| 115 |
-
uploaded_files = st.file_uploader("", type=["txt","mp4","mp3","pdf"],
|
| 116 |
-
accept_multiple_files=True, key="files",
|
| 117 |
-
label_visibility="collapsed")
|
| 118 |
-
st.markdown("馃搧", unsafe_allow_html=True)
|
| 119 |
-
|
| 120 |
-
with col2:
|
| 121 |
-
uploaded_images = st.file_uploader("", type=["jpg", "jpeg", "png", "gif"],
|
| 122 |
-
accept_multiple_files=True, key="images",
|
| 123 |
-
label_visibility="collapsed")
|
| 124 |
-
st.markdown("馃摳", unsafe_allow_html=True)
|
| 125 |
|
| 126 |
with col1:
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
if prompt:
|
| 130 |
content = [prompt]
|
|
|
|
| 72 |
st.set_page_config(page_title="Mariam - Assistant IA", page_icon="馃")
|
| 73 |
st.title("Mariam AI - Chat Intelligent")
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
# CSS personnalis茅 pour le conteneur d'upload
|
| 76 |
st.markdown("""
|
| 77 |
<style>
|
|
|
|
| 85 |
gap: 10px;
|
| 86 |
margin-bottom: 10px;
|
| 87 |
}
|
| 88 |
+
.icon-container {
|
| 89 |
+
display: flex;
|
| 90 |
+
align-items: center;
|
| 91 |
+
gap: 10px;
|
| 92 |
+
}
|
| 93 |
+
.stFileUploader {
|
| 94 |
+
margin-bottom: 0;
|
| 95 |
+
}
|
| 96 |
+
.stFileUploader > div {
|
| 97 |
+
margin-bottom: 0 !important;
|
| 98 |
}
|
| 99 |
</style>
|
| 100 |
""", unsafe_allow_html=True)
|
| 101 |
|
| 102 |
+
# Initialiser l'historique de chat
|
| 103 |
+
if "chat" not in st.session_state:
|
| 104 |
+
st.session_state.chat = model.start_chat(history=[])
|
| 105 |
+
|
| 106 |
# Afficher l'historique des messages
|
| 107 |
for message in st.session_state.chat.history:
|
| 108 |
with st.chat_message(role_to_streamlit(message.role)):
|
|
|
|
| 116 |
input_container = st.container()
|
| 117 |
|
| 118 |
with input_container:
|
| 119 |
+
col1, col2 = st.columns([0.9, 0.1])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
with col1:
|
| 122 |
+
# Conteneur pour l'input et les ic么nes
|
| 123 |
+
input_col1, input_col2, input_col3 = st.columns([0.85, 0.075, 0.075])
|
| 124 |
+
|
| 125 |
+
with input_col1:
|
| 126 |
+
prompt = st.chat_input("Que puis-je faire pour vous ?")
|
| 127 |
+
|
| 128 |
+
with input_col2:
|
| 129 |
+
uploaded_images = st.file_uploader("", type=["jpg", "jpeg", "png", "gif"],
|
| 130 |
+
accept_multiple_files=True, key="images",
|
| 131 |
+
label_visibility="collapsed")
|
| 132 |
+
st.markdown('<div class="icon-container">馃摳</div>', unsafe_allow_html=True)
|
| 133 |
+
|
| 134 |
+
with input_col3:
|
| 135 |
+
uploaded_files = st.file_uploader("", type=["txt","mp4","mp3","pdf"],
|
| 136 |
+
accept_multiple_files=True, key="files",
|
| 137 |
+
label_visibility="collapsed")
|
| 138 |
+
st.markdown('<div class="icon-container">馃搧</div>', unsafe_allow_html=True)
|
| 139 |
|
| 140 |
if prompt:
|
| 141 |
content = [prompt]
|