Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,13 +5,16 @@ from langchain_google_genai.chat_models import ChatGoogleGenerativeAI
|
|
5 |
# Set the path to the service account key
|
6 |
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "./firm-catalyst-437006-s4-407500537db5.json"
|
7 |
|
|
|
|
|
|
|
8 |
# Chat function
|
9 |
def chat_with_gemini(user_input, chat_history):
|
10 |
try:
|
11 |
# Append the user input to the chat history
|
12 |
chat_history.append(("User", user_input))
|
13 |
|
14 |
-
# Get response from the model
|
15 |
response = llm.predict(user_input)
|
16 |
|
17 |
# Append the bot's response to the chat history
|
|
|
5 |
# Set the path to the service account key
|
6 |
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "./firm-catalyst-437006-s4-407500537db5.json"
|
7 |
|
8 |
+
# Initialize the language model
|
9 |
+
llm = ChatGoogleGenerativeAI()
|
10 |
+
|
11 |
# Chat function
|
12 |
def chat_with_gemini(user_input, chat_history):
|
13 |
try:
|
14 |
# Append the user input to the chat history
|
15 |
chat_history.append(("User", user_input))
|
16 |
|
17 |
+
# Get response from the model
|
18 |
response = llm.predict(user_input)
|
19 |
|
20 |
# Append the bot's response to the chat history
|