Spaces:
Runtime error
Runtime error
Commit
·
9c56588
1
Parent(s):
99ec16a
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
import streamlit as st
|
2 |
-
from google.generativeai import GenerativeModel
|
3 |
|
4 |
# Configure API key
|
5 |
-
api_key = "
|
6 |
model_name = "gemini-pro"
|
7 |
|
8 |
# Create model object
|
@@ -19,11 +19,8 @@ user_input = st.text_input("You")
|
|
19 |
|
20 |
# Check if user input is not empty
|
21 |
if user_input:
|
22 |
-
# Create user message object
|
23 |
-
user_message = Content(parts=[Part(text=user_input)], role="user")
|
24 |
-
|
25 |
# Add user message to chat history
|
26 |
-
chat_history.append(
|
27 |
|
28 |
# Display user message with markdown
|
29 |
st.markdown(f"**You:** {user_input}")
|
@@ -36,7 +33,7 @@ if user_input:
|
|
36 |
response_text = response.contents[-1].parts[0].text
|
37 |
|
38 |
# Add response message to chat history
|
39 |
-
chat_history.append(
|
40 |
|
41 |
# Display response message with markdown
|
42 |
st.markdown(f"**Gemini Bot:** {response_text}")
|
|
|
1 |
import streamlit as st
|
2 |
+
from google.generativeai import GenerativeModel
|
3 |
|
4 |
# Configure API key
|
5 |
+
api_key = "AIzaSyC70u1sN87IkoxOoIj4XCAPw97ae2LZwNM"
|
6 |
model_name = "gemini-pro"
|
7 |
|
8 |
# Create model object
|
|
|
19 |
|
20 |
# Check if user input is not empty
|
21 |
if user_input:
|
|
|
|
|
|
|
22 |
# Add user message to chat history
|
23 |
+
chat_history.append(user_input)
|
24 |
|
25 |
# Display user message with markdown
|
26 |
st.markdown(f"**You:** {user_input}")
|
|
|
33 |
response_text = response.contents[-1].parts[0].text
|
34 |
|
35 |
# Add response message to chat history
|
36 |
+
chat_history.append(response_text)
|
37 |
|
38 |
# Display response message with markdown
|
39 |
st.markdown(f"**Gemini Bot:** {response_text}")
|