Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,8 +8,20 @@ load_dotenv()
|
|
8 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
9 |
|
10 |
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
# Function to get response from the model
|
15 |
# Gemini uses 'model' for assistant; Streamlit uses 'assistant'
|
@@ -27,7 +39,7 @@ if "chat" not in st.session_state:
|
|
27 |
st.session_state.chat = model.start_chat(history=[])
|
28 |
|
29 |
# Display Form Title
|
30 |
-
st.title("
|
31 |
|
32 |
# Display chat messages from history above current input box
|
33 |
for message in st.session_state.chat.history:
|
@@ -35,7 +47,7 @@ for message in st.session_state.chat.history:
|
|
35 |
st.markdown(message.parts[0].text)
|
36 |
|
37 |
# Accept user's next message, add to context, resubmit context to Gemini
|
38 |
-
if prompt := st.chat_input("
|
39 |
# Display user's last message
|
40 |
st.chat_message("user").markdown(prompt)
|
41 |
|
|
|
8 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
9 |
|
10 |
|
11 |
+
safety_settings = [
|
12 |
+
{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_NONE"},
|
13 |
+
{"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_NONE"},
|
14 |
+
{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_NONE"},
|
15 |
+
{"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_NONE"},
|
16 |
+
]
|
17 |
+
|
18 |
+
|
19 |
+
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
20 |
+
|
21 |
+
model = genai.GenerativeModel('gemini-1.5-flash',safety_settings=safety_settings,
|
22 |
+
system_instruction="Tu es un assistant intelligent. ton but est d'assister au mieux que tu peux. tu as été créé par Aenir et tu t'appelles Mariam")
|
23 |
+
|
24 |
+
|
25 |
|
26 |
# Function to get response from the model
|
27 |
# Gemini uses 'model' for assistant; Streamlit uses 'assistant'
|
|
|
39 |
st.session_state.chat = model.start_chat(history=[])
|
40 |
|
41 |
# Display Form Title
|
42 |
+
st.title("Mariam AI!")
|
43 |
|
44 |
# Display chat messages from history above current input box
|
45 |
for message in st.session_state.chat.history:
|
|
|
47 |
st.markdown(message.parts[0].text)
|
48 |
|
49 |
# Accept user's next message, add to context, resubmit context to Gemini
|
50 |
+
if prompt := st.chat_input("Hey?"):
|
51 |
# Display user's last message
|
52 |
st.chat_message("user").markdown(prompt)
|
53 |
|