xaochNYU commited on
Commit
8890523
·
verified ·
1 Parent(s): f7d640e

Upload 4 files

Browse files
Files changed (4) hide show
  1. Dockerfile +22 -0
  2. SimpleAgentFlow.json +0 -0
  3. appAgents.py +24 -0
  4. requirements.txt +2 -0
Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.12
5
+
6
+ RUN useradd -m -u 1000 user
7
+ USER user
8
+ ENV PATH="/home/user/.local/bin:$PATH"
9
+
10
+ ENV VIRTUAL_ENV=/home/user/venv
11
+ RUN python -m venv $VIRTUAL_ENV
12
+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
13
+
14
+ WORKDIR /app
15
+ COPY --chown=user ./requirements.txt requirements.txt
16
+ RUN pip install --no-cache-dir --upgrade pip
17
+ RUN pip install --no-cache-dir uv
18
+ RUN pip install --no-cache-dir chainlit
19
+ RUN uv pip install langflow && langflow migration
20
+
21
+ COPY --chown=user . /app
22
+ CMD python3 -m chainlit run appAgents.py --host 0.0.0.0 --port 7860
SimpleAgentFlow.json ADDED
The diff for this file is too large to render. See raw diff
 
appAgents.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import chainlit as cl
2
+
3
+ from langflow.load import load_flow_from_json
4
+ from langflow.processing.process import run_graph
5
+
6
+ google_api_key = "AIzaSyAyGDo-S86WPrMce_vIfePN_mh2_68rJao"
7
+ composio_api_key ="s6q0gx5v78ve5290dpdj8"
8
+
9
+ TWEAKS = {
10
+ "ChatInput-Gbt07": {},
11
+ "ChatOutput-XrgG9": {},
12
+ "ComposioAPI-gmZ8j": {"api_key": composio_api_key},
13
+ "Agent-NB8hJ": {},
14
+ "GoogleGenerativeAIModel-SG7kV": {"api_key": google_api_key},
15
+ "Prompt-oe6ZL": {}
16
+ }
17
+
18
+ @cl.on_message
19
+ async def main(message: cl.Message):
20
+ flow = load_flow_from_json("SimpleAgentFlow.json",tweaks=TWEAKS)
21
+ flow.session_id="session_1"
22
+ flow.user_id="user_1"
23
+ response = await run_graph(flow, input_value=message.content, input_type="chat", output_type="chat")
24
+ await cl.Message(response[0].outputs[0].results["message"].text).send()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ langflow
2
+ chainlit