Spaces:
Runtime error
Runtime error
Commit
·
485a5d1
1
Parent(s):
4a3933f
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
# Import the necessary modules
|
2 |
import google.generativeai as genai
|
|
|
3 |
import streamlit as st
|
4 |
|
5 |
# Configure the google-generativeai library by providing your API key
|
@@ -32,12 +33,13 @@ safety_settings = [
|
|
32 |
}
|
33 |
]
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
36 |
# Use the get function to avoid KeyError if the key does not exist
|
37 |
chat_history = st.session_state.get("chat_history", [])
|
38 |
-
model = st.session_state.get("model", genai.GenerativeModel(model_name="gemini-pro",
|
39 |
-
generation_config=generation_config,
|
40 |
-
safety_settings=safety_settings))
|
41 |
|
42 |
# Create a streamlit interface with a title, a description, and a chat container
|
43 |
st.title("Gemini API") # the title of the interface
|
|
|
1 |
# Import the necessary modules
|
2 |
import google.generativeai as genai
|
3 |
+
# Import the streamlit module and assign it to the alias st
|
4 |
import streamlit as st
|
5 |
|
6 |
# Configure the google-generativeai library by providing your API key
|
|
|
33 |
}
|
34 |
]
|
35 |
|
36 |
+
model = genai.GenerativeModel(model_name="gemini-pro",
|
37 |
+
generation_config=generation_config,
|
38 |
+
safety_settings=safety_settings)
|
39 |
+
|
40 |
+
# Initialize the chat history using session state
|
41 |
# Use the get function to avoid KeyError if the key does not exist
|
42 |
chat_history = st.session_state.get("chat_history", [])
|
|
|
|
|
|
|
43 |
|
44 |
# Create a streamlit interface with a title, a description, and a chat container
|
45 |
st.title("Gemini API") # the title of the interface
|