aiscientist commited on
Commit
0b62f98
·
verified ·
1 Parent(s): 13845c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -13
app.py CHANGED
@@ -1,9 +1,36 @@
 
 
 
1
  import streamlit as st
2
- import os
 
 
 
3
 
4
  def main():
5
- st.sidebar.title("OpenAI Settings")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
 
 
 
 
 
 
7
  openai_api_key = st.sidebar.text_input("Enter your OpenAI API Key", type="password")
8
 
9
  os.environ['OPENAI_API_KEY'] = openai_api_key
@@ -12,18 +39,10 @@ def main():
12
  st.text("A BR CREATION")
13
  st.image("chatbot.jpg", caption="Chatbot", width=178)
14
 
15
-
16
  uploaded_file = st.file_uploader("Upload CSV file", type=["csv"])
17
  if uploaded_file is None:
18
  st.warning("Please upload a CSV file.")
19
  st.stop() # Stop execution if no file uploaded
20
-
21
-
22
- from langchain.llms.openai import OpenAI
23
- from langchain.agents.agent_types import AgentType
24
- #from langchain.agents import create_csv_agent
25
- from langchain_experimental.agents import create_csv_agent
26
- import time
27
 
28
  llm = OpenAI(temperature=0)
29
  agent = create_csv_agent(
@@ -44,8 +63,5 @@ def main():
44
  st.write(answer)
45
  st.write(f"Answer (took {round(end - start, 2)} s.)")
46
 
47
-
48
-
49
  if __name__ == "__main__":
50
  main()
51
-
 
1
+ %%writefile app.py
2
+ import pandas as pd
3
+ from ydata_profiling import ProfileReport
4
  import streamlit as st
5
+ from streamlit_pandas_profiling import st_profile_report
6
+ from langchain.llms.openai import OpenAI
7
+ from langchain.agents.agent_types import AgentType
8
+ import time
9
 
10
  def main():
11
+ st.sidebar.title("App Options")
12
+ option = st.sidebar.selectbox("Choose an option", ["Data Profiling", "Personal Assistant"])
13
+
14
+ if option == "Data Profiling":
15
+ data_profiling()
16
+ elif option == "Personal Assistant":
17
+ personal_assistant()
18
+
19
+ def data_profiling():
20
+ st.title("Data Profiling App")
21
+
22
+ # Load the data
23
+ df = pd.read_csv('data.csv')
24
+
25
+ # Display the dataframe
26
+ st.dataframe(df)
27
 
28
+ # Generate and display the data profile report
29
+ pr = ProfileReport(df, title="Report")
30
+ st_profile_report(pr)
31
+
32
+ def personal_assistant():
33
+ st.sidebar.title("OpenAI Settings")
34
  openai_api_key = st.sidebar.text_input("Enter your OpenAI API Key", type="password")
35
 
36
  os.environ['OPENAI_API_KEY'] = openai_api_key
 
39
  st.text("A BR CREATION")
40
  st.image("chatbot.jpg", caption="Chatbot", width=178)
41
 
 
42
  uploaded_file = st.file_uploader("Upload CSV file", type=["csv"])
43
  if uploaded_file is None:
44
  st.warning("Please upload a CSV file.")
45
  st.stop() # Stop execution if no file uploaded
 
 
 
 
 
 
 
46
 
47
  llm = OpenAI(temperature=0)
48
  agent = create_csv_agent(
 
63
  st.write(answer)
64
  st.write(f"Answer (took {round(end - start, 2)} s.)")
65
 
 
 
66
  if __name__ == "__main__":
67
  main()