Spaces:
Running
Running
Update app.py
Browse filesupdated to use the new chat function
app.py
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
from travel_agent import travel_agent
|
2 |
-
import gradio as gr
|
3 |
-
import os
|
4 |
-
from langchain_google_genai import ChatGoogleGenerativeAI
|
5 |
-
from dotenv import load_dotenv
|
6 |
-
load_dotenv()
|
7 |
-
|
8 |
-
GOOGLE_API_KEY=os.getenv('google_api_key')
|
9 |
-
GEMINI_MODEL='gemini-2.0-flash'
|
10 |
-
llm = ChatGoogleGenerativeAI(google_api_key=GOOGLE_API_KEY, model=GEMINI_MODEL, temperature=0.3)
|
11 |
-
|
12 |
-
#initializing the agent
|
13 |
-
travel_ai=travel_agent(llm)
|
14 |
-
|
15 |
-
|
16 |
-
def chatbot(input, history):
|
17 |
-
#no need for history since agent has state memory already
|
18 |
-
response=travel_ai.
|
19 |
-
return response
|
20 |
-
demo = gr.ChatInterface(chatbot, type="messages", autofocus=False)
|
21 |
-
|
22 |
-
if __name__ == "__main__":
|
23 |
demo.launch()
|
|
|
1 |
+
from travel_agent import travel_agent
|
2 |
+
import gradio as gr
|
3 |
+
import os
|
4 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
5 |
+
from dotenv import load_dotenv
|
6 |
+
load_dotenv()
|
7 |
+
|
8 |
+
GOOGLE_API_KEY=os.getenv('google_api_key')
|
9 |
+
GEMINI_MODEL='gemini-2.0-flash'
|
10 |
+
llm = ChatGoogleGenerativeAI(google_api_key=GOOGLE_API_KEY, model=GEMINI_MODEL, temperature=0.3)
|
11 |
+
|
12 |
+
#initializing the agent
|
13 |
+
travel_ai=travel_agent(llm)
|
14 |
+
|
15 |
+
|
16 |
+
def chatbot(input, history):
|
17 |
+
#no need for history since agent has state memory already
|
18 |
+
response=travel_ai.chat(input)
|
19 |
+
return response
|
20 |
+
demo = gr.ChatInterface(chatbot, type="messages", autofocus=False)
|
21 |
+
|
22 |
+
if __name__ == "__main__":
|
23 |
demo.launch()
|