3v324v23 commited on
Commit
11b3c92
·
1 Parent(s): 0a03faf
Files changed (2) hide show
  1. app.py +10 -7
  2. data.csv +101 -0
app.py CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
2
  import pandas as pd
3
  from langchain.agents import create_csv_agent
4
  from langchain.llms import OpenAI
5
-
6
  # Set Streamlit page configuration
7
  st.set_page_config(page_title='CSV Processing',
8
  page_icon=":memo:",
@@ -74,17 +74,20 @@ if not openai_api_key or not openai_api_key.startswith('sk-'):
74
  else:
75
  if uploaded_file is not None:
76
  # Create a progress bar
77
- progress_bar = st.progress(0)
78
- progress_bar.progress(25) # Start the progress at 25%
79
-
80
  csv_file = load_data(uploaded_file) # Now the uploaded file is an XLS file
81
- progress_bar.progress(50) # Update the progress to 50%
82
 
83
  agent = initialize_agent(csv_file, openai_api_key)
84
- progress_bar.progress(100) # Complete the progress bar
85
 
86
  if question:
87
  response = agent.run(question)
 
 
 
88
  #st.markdown(f'**Response:** {response}')
89
- st.markdown(f'<div style="color: red; font-size: 24px; text-align: center;">**{response}**</div>',unsafe_allow_html=True)
90
 
 
2
  import pandas as pd
3
  from langchain.agents import create_csv_agent
4
  from langchain.llms import OpenAI
5
+ import time
6
  # Set Streamlit page configuration
7
  st.set_page_config(page_title='CSV Processing',
8
  page_icon=":memo:",
 
74
  else:
75
  if uploaded_file is not None:
76
  # Create a progress bar
77
+ #progress_bar = st.progress(0)
78
+ #progress_bar.progress(25) # Start the progress at 25%
79
+
80
  csv_file = load_data(uploaded_file) # Now the uploaded file is an XLS file
81
+ #progress_bar.progress(50) # Update the progress to 50%
82
 
83
  agent = initialize_agent(csv_file, openai_api_key)
84
+ #progress_bar.progress(100) # Complete the progress bar
85
 
86
  if question:
87
  response = agent.run(question)
88
+ with st.spinner('Wait for it...'):
89
+ time.sleep(5)
90
+ st.success('Done!')
91
  #st.markdown(f'**Response:** {response}')
92
+ st.markdown(f'<div style="color: red; font-size: 24px; text-align: center;">The Answer is:{response}</div>',unsafe_allow_html=True)
93
 
data.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0,First Name,Last Name,Gender,Country,Age,Date,Id
2
+ 1,Dulce,Abril,Female,United States,32,15/10/2017,1562
3
+ 2,Mara,Hashimoto,Female,Great Britain,25,16/08/2016,1582
4
+ 3,Philip,Gent,Male,France,36,21/05/2015,2587
5
+ 4,Kathleen,Hanner,Female,United States,25,15/10/2017,3549
6
+ 5,Nereida,Magwood,Female,United States,58,16/08/2016,2468
7
+ 6,Gaston,Brumm,Male,United States,24,21/05/2015,2554
8
+ 7,Etta,Hurn,Female,Great Britain,56,15/10/2017,3598
9
+ 8,Earlean,Melgar,Female,United States,27,16/08/2016,2456
10
+ 9,Vincenza,Weiland,Female,United States,40,21/05/2015,6548
11
+ 10,Fallon,Winward,Female,Great Britain,28,16/08/2016,5486
12
+ 11,Arcelia,Bouska,Female,Great Britain,39,21/05/2015,1258
13
+ 12,Franklyn,Unknow,Male,France,38,15/10/2017,2579
14
+ 13,Sherron,Ascencio,Female,Great Britain,32,16/08/2016,3256
15
+ 14,Marcel,Zabriskie,Male,Great Britain,26,21/05/2015,2587
16
+ 15,Kina,Hazelton,Female,Great Britain,31,16/08/2016,3259
17
+ 16,Shavonne,Pia,Female,France,24,21/05/2015,1546
18
+ 17,Shavon,Benito,Female,France,39,15/10/2017,3579
19
+ 18,Lauralee,Perrine,Female,Great Britain,28,16/08/2016,6597
20
+ 19,Loreta,Curren,Female,France,26,21/05/2015,9654
21
+ 20,Teresa,Strawn,Female,France,46,21/05/2015,3569
22
+ 21,Belinda,Partain,Female,United States,37,15/10/2017,2564
23
+ 22,Holly,Eudy,Female,United States,52,16/08/2016,8561
24
+ 23,Many,Cuccia,Female,Great Britain,46,21/05/2015,5489
25
+ 24,Libbie,Dalby,Female,France,42,21/05/2015,5489
26
+ 25,Lester,Prothro,Male,France,21,15/10/2017,6574
27
+ 26,Marvel,Hail,Female,Great Britain,28,16/08/2016,5555
28
+ 27,Angelyn,Vong,Female,United States,29,21/05/2015,6125
29
+ 28,Francesca,Beaudreau,Female,France,23,15/10/2017,5412
30
+ 29,Garth,Gangi,Male,United States,41,16/08/2016,3256
31
+ 30,Carla,Trumbull,Female,Great Britain,28,21/05/2015,3264
32
+ 31,Veta,Muntz,Female,Great Britain,37,15/10/2017,4569
33
+ 32,Stasia,Becker,Female,Great Britain,34,16/08/2016,7521
34
+ 33,Jona,Grindle,Female,Great Britain,26,21/05/2015,6458
35
+ 34,Judie,Claywell,Female,France,35,16/08/2016,7569
36
+ 35,Dewitt,Borger,Male,United States,36,21/05/2015,8514
37
+ 36,Nena,Hacker,Female,United States,29,15/10/2017,8563
38
+ 37,Kelsie,Wachtel,Female,France,27,16/08/2016,8642
39
+ 38,Sau,Pfau,Female,United States,25,21/05/2015,9536
40
+ 39,Shanice,Mccrystal,Female,United States,36,21/05/2015,2567
41
+ 40,Chase,Karner,Male,United States,37,15/10/2017,2154
42
+ 41,Tommie,Underdahl,Male,United States,26,16/08/2016,3265
43
+ 42,Dorcas,Darity,Female,United States,37,21/05/2015,8765
44
+ 43,Angel,Sanor,Male,France,24,15/10/2017,3259
45
+ 44,Willodean,Harn,Female,United States,39,16/08/2016,3567
46
+ 45,Weston,Martina,Male,United States,26,21/05/2015,6540
47
+ 46,Roma,Lafollette,Female,United States,34,15/10/2017,2654
48
+ 47,Felisa,Cail,Female,United States,28,16/08/2016,6525
49
+ 48,Demetria,Abbey,Female,United States,32,21/05/2015,3265
50
+ 49,Jeromy,Danz,Male,United States,39,15/10/2017,3265
51
+ 50,Rasheeda,Alkire,Female,United States,29,16/08/2016,6125
52
+ 51,Dulce,Abril,Female,United States,32,15/10/2017,1562
53
+ 52,Mara,Hashimoto,Female,Great Britain,25,16/08/2016,1582
54
+ 53,Philip,Gent,Male,France,36,21/05/2015,2587
55
+ 54,Kathleen,Hanner,Female,United States,25,15/10/2017,3549
56
+ 55,Nereida,Magwood,Female,United States,58,16/08/2016,2468
57
+ 56,Gaston,Brumm,Male,United States,24,21/05/2015,2554
58
+ 57,Etta,Hurn,Female,Great Britain,56,15/10/2017,3598
59
+ 58,Earlean,Melgar,Female,United States,27,16/08/2016,2456
60
+ 59,Vincenza,Weiland,Female,United States,40,21/05/2015,6548
61
+ 60,Fallon,Winward,Female,Great Britain,28,16/08/2016,5486
62
+ 61,Arcelia,Bouska,Female,Great Britain,39,21/05/2015,1258
63
+ 62,Franklyn,Unknow,Male,France,38,15/10/2017,2579
64
+ 63,Sherron,Ascencio,Female,Great Britain,32,16/08/2016,3256
65
+ 64,Marcel,Zabriskie,Male,Great Britain,26,21/05/2015,2587
66
+ 65,Kina,Hazelton,Female,Great Britain,31,16/08/2016,3259
67
+ 66,Shavonne,Pia,Female,France,24,21/05/2015,1546
68
+ 67,Shavon,Benito,Female,France,39,15/10/2017,3579
69
+ 68,Lauralee,Perrine,Female,Great Britain,28,16/08/2016,6597
70
+ 69,Loreta,Curren,Female,France,26,21/05/2015,9654
71
+ 70,Teresa,Strawn,Female,France,46,21/05/2015,3569
72
+ 71,Belinda,Partain,Female,United States,37,15/10/2017,2564
73
+ 72,Holly,Eudy,Female,United States,52,16/08/2016,8561
74
+ 73,Many,Cuccia,Female,Great Britain,46,21/05/2015,5489
75
+ 74,Libbie,Dalby,Female,France,42,21/05/2015,5489
76
+ 75,Lester,Prothro,Male,France,21,15/10/2017,6574
77
+ 76,Marvel,Hail,Female,Great Britain,28,16/08/2016,5555
78
+ 77,Angelyn,Vong,Female,United States,29,21/05/2015,6125
79
+ 78,Francesca,Beaudreau,Female,France,23,15/10/2017,5412
80
+ 79,Garth,Gangi,Male,United States,41,16/08/2016,3256
81
+ 80,Carla,Trumbull,Female,Great Britain,28,21/05/2015,3264
82
+ 81,Veta,Muntz,Female,Great Britain,37,15/10/2017,4569
83
+ 82,Stasia,Becker,Female,Great Britain,34,16/08/2016,7521
84
+ 83,Jona,Grindle,Female,Great Britain,26,21/05/2015,6458
85
+ 84,Judie,Claywell,Female,France,35,16/08/2016,7569
86
+ 85,Dewitt,Borger,Male,United States,36,21/05/2015,8514
87
+ 86,Nena,Hacker,Female,United States,29,15/10/2017,8563
88
+ 87,Kelsie,Wachtel,Female,France,27,16/08/2016,8642
89
+ 88,Sau,Pfau,Female,United States,25,21/05/2015,9536
90
+ 89,Shanice,Mccrystal,Female,United States,36,21/05/2015,2567
91
+ 90,Chase,Karner,Male,United States,37,15/10/2017,2154
92
+ 91,Tommie,Underdahl,Male,United States,26,16/08/2016,3265
93
+ 92,Dorcas,Darity,Female,United States,37,21/05/2015,8765
94
+ 93,Angel,Sanor,Male,France,24,15/10/2017,3259
95
+ 94,Willodean,Harn,Female,United States,39,16/08/2016,3567
96
+ 95,Weston,Martina,Male,United States,26,21/05/2015,6540
97
+ 96,Roma,Lafollette,Female,United States,34,15/10/2017,2654
98
+ 97,Felisa,Cail,Female,United States,28,16/08/2016,6525
99
+ 98,Demetria,Abbey,Female,United States,32,21/05/2015,3265
100
+ 99,Jeromy,Danz,Male,United States,39,15/10/2017,3265
101
+ 100,Rasheeda,Alkire,Female,United States,29,16/08/2016,6125