Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +32 -0
- requirements.txt +76 -0
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from langchain_core.prompts import ChatPromptTemplate
|
3 |
+
from langchain_openai import ChatOpenAI
|
4 |
+
from langgraph.graph import StateGraph, END
|
5 |
+
from typing import Dict, List
|
6 |
+
|
7 |
+
# Assume you have your LangGraph setup here
|
8 |
+
def agent_node(state):
|
9 |
+
prompt = ChatPromptTemplate.from_messages(
|
10 |
+
[("user", "{user_input}")]
|
11 |
+
)
|
12 |
+
model = ChatOpenAI()
|
13 |
+
response = model.invoke(prompt.format_messages(**state))
|
14 |
+
return {"response": response.content}
|
15 |
+
|
16 |
+
def create_workflow():
|
17 |
+
workflow = StateGraph(Dict)
|
18 |
+
workflow.add_node("agent", agent_node)
|
19 |
+
workflow.set_entry_point("agent")
|
20 |
+
workflow.add_edge("agent", END)
|
21 |
+
return workflow.compile()
|
22 |
+
|
23 |
+
workflow = create_workflow()
|
24 |
+
|
25 |
+
def respond(message, history):
|
26 |
+
result = workflow.invoke({"user_input": message})
|
27 |
+
return result["response"]
|
28 |
+
|
29 |
+
iface = gr.ChatInterface(respond)
|
30 |
+
iface.launch()
|
31 |
+
|
32 |
+
gr.close_all()
|
requirements.txt
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
aiofiles==23.2.1
|
2 |
+
annotated-types==0.7.0
|
3 |
+
anyio==4.9.0
|
4 |
+
certifi==2025.1.31
|
5 |
+
charset-normalizer==3.4.1
|
6 |
+
click==8.1.8
|
7 |
+
distro==1.9.0
|
8 |
+
fastapi==0.115.12
|
9 |
+
ffmpy==0.5.0
|
10 |
+
filelock==3.18.0
|
11 |
+
fsspec==2025.3.2
|
12 |
+
gradio==5.23.2
|
13 |
+
gradio_client==1.8.0
|
14 |
+
greenlet==3.1.1
|
15 |
+
groovy==0.1.2
|
16 |
+
h11==0.14.0
|
17 |
+
httpcore==1.0.7
|
18 |
+
httpx==0.28.1
|
19 |
+
huggingface-hub==0.30.1
|
20 |
+
idna==3.10
|
21 |
+
Jinja2==3.1.6
|
22 |
+
jiter==0.9.0
|
23 |
+
jsonpatch==1.33
|
24 |
+
jsonpointer==3.0.0
|
25 |
+
langchain==0.3.22
|
26 |
+
langchain-core==0.3.49
|
27 |
+
langchain-openai==0.3.11
|
28 |
+
langchain-text-splitters==0.3.7
|
29 |
+
langgraph==0.3.21
|
30 |
+
langgraph-checkpoint==2.0.23
|
31 |
+
langgraph-prebuilt==0.1.7
|
32 |
+
langgraph-sdk==0.1.60
|
33 |
+
langsmith==0.3.21
|
34 |
+
markdown-it-py==3.0.0
|
35 |
+
MarkupSafe==3.0.2
|
36 |
+
mdurl==0.1.2
|
37 |
+
numpy==2.2.4
|
38 |
+
openai==1.70.0
|
39 |
+
orjson==3.10.16
|
40 |
+
ormsgpack==1.9.1
|
41 |
+
packaging==24.2
|
42 |
+
pandas==2.2.3
|
43 |
+
pillow==11.1.0
|
44 |
+
pydantic==2.11.1
|
45 |
+
pydantic_core==2.33.0
|
46 |
+
pydub==0.25.1
|
47 |
+
Pygments==2.19.1
|
48 |
+
python-dateutil==2.9.0.post0
|
49 |
+
python-multipart==0.0.20
|
50 |
+
pytz==2025.2
|
51 |
+
PyYAML==6.0.2
|
52 |
+
regex==2024.11.6
|
53 |
+
requests==2.32.3
|
54 |
+
requests-toolbelt==1.0.0
|
55 |
+
rich==14.0.0
|
56 |
+
ruff==0.11.2
|
57 |
+
safehttpx==0.1.6
|
58 |
+
semantic-version==2.10.0
|
59 |
+
shellingham==1.5.4
|
60 |
+
six==1.17.0
|
61 |
+
sniffio==1.3.1
|
62 |
+
SQLAlchemy==2.0.40
|
63 |
+
starlette==0.46.1
|
64 |
+
tenacity==9.0.0
|
65 |
+
tiktoken==0.9.0
|
66 |
+
tomlkit==0.13.2
|
67 |
+
tqdm==4.67.1
|
68 |
+
typer==0.15.2
|
69 |
+
typing-inspection==0.4.0
|
70 |
+
typing_extensions==4.13.0
|
71 |
+
tzdata==2025.2
|
72 |
+
urllib3==2.3.0
|
73 |
+
uvicorn==0.34.0
|
74 |
+
websockets==15.0.1
|
75 |
+
xxhash==3.5.0
|
76 |
+
zstandard==0.23.0
|