Delete app.py
Browse files
app.py
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from langchain_core.messages import HumanMessage
|
3 |
-
from agent import assistant, AgentState
|
4 |
-
|
5 |
-
def respond(message, history=None):
|
6 |
-
history = history or []
|
7 |
-
# Append new user message
|
8 |
-
messages = history + [HumanMessage(content=message)]
|
9 |
-
|
10 |
-
state = {"messages": messages}
|
11 |
-
result = assistant(state)
|
12 |
-
|
13 |
-
# Get the response text
|
14 |
-
response_msg = result["messages"][-1].content
|
15 |
-
|
16 |
-
# Append bot response to history
|
17 |
-
history.append(HumanMessage(content=message))
|
18 |
-
history.append(HumanMessage(content=response_msg))
|
19 |
-
|
20 |
-
return response_msg, history
|
21 |
-
|
22 |
-
demo = gr.ChatInterface(respond)
|
23 |
-
|
24 |
-
if __name__ == "__main__":
|
25 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|