Commit
·
1270271
1
Parent(s):
88d455c
English to french labels
Browse files
app.py
CHANGED
@@ -29,9 +29,10 @@ def get_llm_hf_inference(model_id=model_id, max_new_tokens=128, temperature=0.1)
|
|
29 |
return llm
|
30 |
|
31 |
# Configure the Streamlit app
|
32 |
-
st.set_page_config(page_title="
|
33 |
-
st.title("
|
34 |
-
|
|
|
35 |
|
36 |
# Initialize session state for avatars
|
37 |
if "avatars" not in st.session_state:
|
@@ -46,22 +47,22 @@ if "max_response_length" not in st.session_state:
|
|
46 |
st.session_state.max_response_length = 256
|
47 |
|
48 |
if "system_message" not in st.session_state:
|
49 |
-
st.session_state.system_message = "
|
50 |
|
51 |
if "starter_message" not in st.session_state:
|
52 |
-
st.session_state.starter_message = "
|
53 |
|
54 |
|
55 |
# Sidebar for settings
|
56 |
with st.sidebar:
|
57 |
-
st.header("
|
58 |
|
59 |
# AI Settings
|
60 |
st.session_state.system_message = st.text_area(
|
61 |
-
"
|
62 |
)
|
63 |
st.session_state.starter_message = st.text_area(
|
64 |
-
'
|
65 |
)
|
66 |
|
67 |
# Model Settings
|
@@ -74,14 +75,14 @@ with st.sidebar:
|
|
74 |
col1, col2 = st.columns(2)
|
75 |
with col1:
|
76 |
st.session_state.avatars['assistant'] = st.selectbox(
|
77 |
-
"
|
78 |
)
|
79 |
with col2:
|
80 |
st.session_state.avatars['user'] = st.selectbox(
|
81 |
-
"
|
82 |
)
|
83 |
# Reset Chat History
|
84 |
-
reset_history = st.button("
|
85 |
|
86 |
# Initialize or reset chat history
|
87 |
if "chat_history" not in st.session_state or reset_history:
|
@@ -132,7 +133,7 @@ def get_response(system_message, chat_history, user_text,
|
|
132 |
chat_interface = st.container(border=True)
|
133 |
with chat_interface:
|
134 |
output_container = st.container()
|
135 |
-
st.session_state.user_text = st.chat_input(placeholder="
|
136 |
|
137 |
# Display chat messages
|
138 |
with output_container:
|
|
|
29 |
return llm
|
30 |
|
31 |
# Configure the Streamlit app
|
32 |
+
st.set_page_config(page_title="Chatbot de service après-vente", page_icon="🤗")
|
33 |
+
st.title("Chatbot de service après-vente")
|
34 |
+
# A réactiver si on veut une petite description du chatbot
|
35 |
+
#st.markdown(f"*This is a simple chatbot that uses the HuggingFace transformers library to generate responses to your text input. It uses the {model_id}.*")
|
36 |
|
37 |
# Initialize session state for avatars
|
38 |
if "avatars" not in st.session_state:
|
|
|
47 |
st.session_state.max_response_length = 256
|
48 |
|
49 |
if "system_message" not in st.session_state:
|
50 |
+
st.session_state.system_message = "Tu es un assistant de service après-vente très sympatique qui parlera en français avec un client humain."
|
51 |
|
52 |
if "starter_message" not in st.session_state:
|
53 |
+
st.session_state.starter_message = "Bonjour, comment puis-je vous aider aujourd'hui ?"
|
54 |
|
55 |
|
56 |
# Sidebar for settings
|
57 |
with st.sidebar:
|
58 |
+
st.header("Configuration")
|
59 |
|
60 |
# AI Settings
|
61 |
st.session_state.system_message = st.text_area(
|
62 |
+
"Configuration du contexte de l\'assistant", value="Tu es un assistant de service après-vente très sympatique qui parlera en français avec un client humain."
|
63 |
)
|
64 |
st.session_state.starter_message = st.text_area(
|
65 |
+
'Premier message de l\'assistant', value="Bonjour, comment puis-je vous aider aujourd'hui ?"
|
66 |
)
|
67 |
|
68 |
# Model Settings
|
|
|
75 |
col1, col2 = st.columns(2)
|
76 |
with col1:
|
77 |
st.session_state.avatars['assistant'] = st.selectbox(
|
78 |
+
"Avatar de l'assistant", options=["🤗", "💬", "🤖"], index=0
|
79 |
)
|
80 |
with col2:
|
81 |
st.session_state.avatars['user'] = st.selectbox(
|
82 |
+
"Avatar de l'utilisateur", options=["👤", "👱♂️", "👨🏾", "👩", "👧🏾"], index=0
|
83 |
)
|
84 |
# Reset Chat History
|
85 |
+
reset_history = st.button("Réinitialiser la conversation")
|
86 |
|
87 |
# Initialize or reset chat history
|
88 |
if "chat_history" not in st.session_state or reset_history:
|
|
|
133 |
chat_interface = st.container(border=True)
|
134 |
with chat_interface:
|
135 |
output_container = st.container()
|
136 |
+
st.session_state.user_text = st.chat_input(placeholder="Poser votre question.")
|
137 |
|
138 |
# Display chat messages
|
139 |
with output_container:
|