chandrakalagowda commited on
Commit
9b0626d
·
1 Parent(s): 306243c

Upload 6 files

Browse files
Files changed (6) hide show
  1. app.py +37 -0
  2. data.csv +0 -0
  3. get-pip.py +0 -0
  4. insightly_wbg.png +0 -0
  5. requirements.txt +100 -0
  6. tempfile +0 -0
app.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from tempfile import NamedTemporaryFile
2
+ from langchain.agents import create_csv_agent
3
+ from langchain.llms import OpenAI
4
+ from dotenv import load_dotenv
5
+ import os
6
+ import streamlit as st
7
+
8
+
9
+
10
+ def main():
11
+ load_dotenv()
12
+
13
+ # Load the OpenAI API key from the environment variable
14
+ api_key = os.getenv("OPENAI_API_KEY")
15
+ if api_key is None or api_key == "":
16
+ st.error("OPENAI_API_KEY is not set")
17
+ return
18
+
19
+ st.set_page_config(page_title="Insightly")
20
+ st.sidebar.image("https://i.ibb.co/x807Xkj/insightly-wbg.png", use_column_width=True)
21
+ st.header("Data Analysis 📈")
22
+
23
+ csv_file = st.file_uploader("Upload a CSV file", type="csv")
24
+ if csv_file:
25
+ with NamedTemporaryFile(delete=False) as f:
26
+ f.write(csv_file.getvalue())
27
+ f.flush()
28
+ llm = OpenAI(temperature=0)
29
+ user_input = st.text_input("Question here:")
30
+ agent = create_csv_agent(llm, f.name, verbose=True)
31
+ if user_input:
32
+ response = agent.run(user_input)
33
+ st.write(response)
34
+
35
+
36
+ if __name__ == "__main__":
37
+ main()
data.csv ADDED
The diff for this file is too large to render. See raw diff
 
get-pip.py ADDED
The diff for this file is too large to render. See raw diff
 
insightly_wbg.png ADDED
requirements.txt ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiohttp==3.8.4
2
+ aiosignal==1.3.1
3
+ altair==5.0.1
4
+ appnope==0.1.3
5
+ asttokens==2.2.1
6
+ async-timeout==4.0.2
7
+ attrs==23.1.0
8
+ backcall==0.2.0
9
+ blinker==1.6.2
10
+ cachetools==5.3.1
11
+ certifi==2023.5.7
12
+ charset-normalizer==3.1.0
13
+ click==8.1.3
14
+ comm==0.1.3
15
+ dataclasses-json==0.5.8
16
+ debugpy==1.6.7
17
+ decorator==5.1.1
18
+ executing==1.2.0
19
+ faiss-cpu==1.7.4
20
+ filelock==3.12.2
21
+ frozenlist==1.3.3
22
+ fsspec==2023.6.0
23
+ gitdb==4.0.10
24
+ GitPython==3.1.31
25
+ greenlet==2.0.2
26
+ huggingface-hub==0.15.1
27
+ idna==3.4
28
+ importlib-metadata==6.6.0
29
+ ipykernel==6.23.2
30
+ ipython==8.14.0
31
+ jedi==0.18.2
32
+ Jinja2==3.1.2
33
+ jsonschema==4.17.3
34
+ jupyter_client==8.2.0
35
+ jupyter_core==5.3.1
36
+ langchain==0.0.201
37
+ langchainplus-sdk==0.0.10
38
+ markdown-it-py==3.0.0
39
+ MarkupSafe==2.1.3
40
+ marshmallow==3.19.0
41
+ marshmallow-enum==1.5.1
42
+ matplotlib-inline==0.1.6
43
+ mdurl==0.1.2
44
+ multidict==6.0.4
45
+ mypy-extensions==1.0.0
46
+ nest-asyncio==1.5.6
47
+ numexpr==2.8.4
48
+ numpy==1.24.3
49
+ openai==0.27.8
50
+ openapi-schema-pydantic==1.2.4
51
+ packaging==23.1
52
+ pandas==2.0.2
53
+ parso==0.8.3
54
+ pexpect==4.8.0
55
+ pickleshare==0.7.5
56
+ Pillow==9.5.0
57
+ platformdirs==3.5.3
58
+ prompt-toolkit==3.0.38
59
+ protobuf==4.23.3
60
+ psutil==5.9.5
61
+ ptyprocess==0.7.0
62
+ pure-eval==0.2.2
63
+ pyarrow==12.0.1
64
+ pydantic==1.10.9
65
+ pydeck==0.8.1b0
66
+ Pygments==2.15.1
67
+ Pympler==1.0.1
68
+ PyPDF2==3.0.1
69
+ pyrsistent==0.19.3
70
+ python-dateutil==2.8.2
71
+ python-dotenv==1.0.0
72
+ pytz==2023.3
73
+ pytz-deprecation-shim==0.1.0.post0
74
+ PyYAML==6.0
75
+ pyzmq==25.1.0
76
+ regex==2023.6.3
77
+ requests==2.31.0
78
+ rich==13.4.2
79
+ six==1.16.0
80
+ smmap==5.0.0
81
+ SQLAlchemy==2.0.16
82
+ stack-data==0.6.2
83
+ streamlit==1.23.1
84
+ tabulate==0.9.0
85
+ tenacity==8.2.2
86
+ tiktoken==0.4.0
87
+ toml==0.10.2
88
+ toolz==0.12.0
89
+ tornado==6.3.2
90
+ tqdm==4.65.0
91
+ traitlets==5.9.0
92
+ typing-inspect==0.9.0
93
+ typing_extensions==4.6.3
94
+ tzdata==2023.3
95
+ tzlocal==4.3
96
+ urllib3==2.0.3
97
+ validators==0.20.0
98
+ wcwidth==0.2.6
99
+ yarl==1.9.2
100
+ zipp==3.15.0
tempfile ADDED
The diff for this file is too large to render. See raw diff