Spaces:
Sleeping
Sleeping
martianband1t
commited on
Commit
•
043a2a8
1
Parent(s):
ccffbaa
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
import streamlit as st
|
2 |
import replicate
|
3 |
-
import numpy as np
|
4 |
|
5 |
st.title("Ayoye, c'est bien hot ça!!")
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
|
10 |
-
if 'messages' not in st.session_state:
|
11 |
-
st.session_state['messages'] = []
|
12 |
|
|
|
|
|
13 |
# Formulaire pour entrer une question
|
14 |
with st.form("chat_input"):
|
15 |
user_input = st.text_input("Entrez votre question ici:", "")
|
@@ -24,19 +23,18 @@ with st.container():
|
|
24 |
input={
|
25 |
"top_p": 0.9,
|
26 |
"prompt": user_input,
|
27 |
-
"max_tokens":
|
28 |
-
"min_tokens":
|
29 |
-
"temperature": 0.
|
30 |
"prompt_template": "system\n\nYou are a helpful assistantuser\n\n{prompt}assistant\n\n",
|
31 |
"presence_penalty": 0,
|
32 |
"frequency_penalty": 0
|
33 |
}
|
34 |
)
|
35 |
|
36 |
-
#
|
37 |
st.session_state['messages'].append(f"Bot: {output}")
|
38 |
|
39 |
-
# Affichage des messages précédents
|
40 |
-
for
|
41 |
-
st.text(
|
42 |
-
|
|
|
1 |
import streamlit as st
|
2 |
import replicate
|
|
|
3 |
|
4 |
st.title("Ayoye, c'est bien hot ça!!")
|
5 |
|
6 |
+
# Initialisation d'une liste pour stocker les messages
|
7 |
+
if 'messages' not in st.session_state:
|
8 |
+
st.session_state['messages'] = []
|
|
|
|
|
9 |
|
10 |
+
# Conteneur unique pour le chat complet
|
11 |
+
with st.container():
|
12 |
# Formulaire pour entrer une question
|
13 |
with st.form("chat_input"):
|
14 |
user_input = st.text_input("Entrez votre question ici:", "")
|
|
|
23 |
input={
|
24 |
"top_p": 0.9,
|
25 |
"prompt": user_input,
|
26 |
+
"max_tokens": 512,
|
27 |
+
"min_tokens": 0,
|
28 |
+
"temperature": 0.6,
|
29 |
"prompt_template": "system\n\nYou are a helpful assistantuser\n\n{prompt}assistant\n\n",
|
30 |
"presence_penalty": 0,
|
31 |
"frequency_penalty": 0
|
32 |
}
|
33 |
)
|
34 |
|
35 |
+
# Ajout de la réponse du modèle
|
36 |
st.session_state['messages'].append(f"Bot: {output}")
|
37 |
|
38 |
+
# Affichage des messages précédents dans le même conteneur
|
39 |
+
for msg in st.session_state['messages']:
|
40 |
+
st.text(msg)
|
|