xaochNYU commited on
Commit
c25b046
·
verified ·
1 Parent(s): 360e36b

Upload 4 files

Browse files
Files changed (4) hide show
  1. AgentFlow2.json +0 -0
  2. Dockerfile +22 -0
  3. app.py +28 -0
  4. requirements.txt +2 -0
AgentFlow2.json ADDED
The diff for this file is too large to render. See raw diff
 
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 app.py --host 0.0.0.0 --port 7860
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import chainlit as cl
2
+ import os
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-2x8vF": {},
11
+ "Prompt-CLQNW": {},
12
+ "Agent-6ilGB": {"api_key":google_api_key},
13
+ "Agent-e7sUF": {"api_key":google_api_key},
14
+ "Agent-womuY": {"api_key":google_api_key},
15
+ "ComposioAPI-RfpkY": {"api_key":composio_api_key},
16
+ "Agent-g9eV8": {"api_key":google_api_key},
17
+ "ChatOutput-IIhYR": {},
18
+ "Prompt-Od4Ay": {},
19
+ "Agent-CjuzA": {"api_key":google_api_key}
20
+ }
21
+
22
+ @cl.on_message
23
+ async def main(message: cl.Message):
24
+ flow = load_flow_from_json("AgentFlow2.json",tweaks=TWEAKS)
25
+ flow.session_id="session_1"
26
+ flow.user_id="user_1"
27
+ response = await run_graph(flow, input_value=message.content, input_type="chat", output_type="chat")
28
+ await cl.Message(response[0].outputs[0].results["message"].text).send()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ chainlit
2
+ langflow